From 5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 Mon Sep 17 00:00:00 2001 From: svn2git Date: Fri, 1 Jul 1994 00:00:00 -0800 Subject: [PATCH] Release FreeBSD 1.1.5.1 This commit was manufactured to restore the state of the 1.1.5.1-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs. --- CONTRIB.FreeBSD | 56 +- COPYRIGHT.FreeBSD | 8 +- COPYRIGHT.USL | 4 +- KNOWNBUGS | 23 +- MIRROR.SITES | 28 +- Makefile | 68 +- REGISTER.FreeBSD | 86 + RELNOTES.FreeBSD | 87 +- ROSTER.FreeBSD | 127 + SUPPORT.TXT | 81 +- TODO-1.1.5 | 38 + bin/cp/cp.c | 4 +- bin/cp/path.c | 2 +- bin/csh/char.c | 4 +- bin/csh/char.h | 2 +- bin/csh/dol.c | 4 +- bin/csh/lex.c | 6 +- bin/df/df.c | 2 +- bin/ed/Makefile | 2 +- bin/ed/buf.c | 10 +- bin/ed/cbc.c | 2 +- bin/ed/ed.h | 17 +- bin/ed/{glob.c => glbl.c} | 2 +- bin/ed/io.c | 2 +- bin/ed/main.c | 2 +- bin/ed/re.c | 2 +- bin/ed/sub.c | 2 +- bin/ed/undo.c | 2 +- bin/expr/expr.1 | 2 +- bin/ls/ls.1 | 2 +- bin/mkdir/mkdir.1 | 2 +- bin/mkdir/mkdir.c | 4 +- bin/mv/mv.c | 4 +- bin/rcp/Makefile | 10 +- bin/rm/rm.c | 2 +- bin/rmail/rmail.c | 1 - bin/rmdir/rmdir.c | 4 +- bin/sh/builtins | 2 +- bin/sh/cd.c | 2 +- bin/sh/expand.c | 8 +- bin/sh/miscbltin.c | 4 +- bin/stty/cchar.c | 10 +- bin/stty/gfmt.c | 4 +- bin/stty/key.c | 2 +- bin/stty/print.c | 10 +- contrib/FAQ/FreeBSD.FAQ | 954 ++ contrib/FAQ/OTHER-FAQS/FreeBSD.current.policy | 162 + contrib/FAQ/OTHER-FAQS/FreeBSD.kdebug.FAQ | 33 + .../FAQ/OTHER-FAQS/FreeBSD.mailing-list.FAQ | 77 + contrib/FAQ/OTHER-FAQS/FreeBSD.ports.supfile | 18 + .../FAQ/OTHER-FAQS/FreeBSD.slip.dialup.faq | 172 + .../FAQ/OTHER-FAQS/FreeBSD.standard.supfile | 16 + contrib/FAQ/OTHER-FAQS/FreeBSD.sup.faq | 98 + contrib/FAQ/OTHER-FAQS/FreeBSDvsLinux | 70 + contrib/FAQ/OTHER-FAQS/NFS | 77 + contrib/FAQ/OTHER-FAQS/Systems.FAQ | 266 + contrib/FAQ/code/printcap01/Makefile | 22 + contrib/FAQ/code/printcap01/README | 14 + contrib/FAQ/code/printcap01/hpf.c | 38 + contrib/FAQ/code/printcap01/printcap.sample | 9 + contrib/FAQ/code/printcap01/ps2lj3 | 4 + contrib/Makefile | 4 +- contrib/adduser/AddIt | 249 + contrib/adduser/README | 40 + contrib/adduser/dot.cshrc | 27 + contrib/adduser/dot.login | 15 + contrib/adduser/dot.profile | 2 + contrib/adduser/userids | 1 + contrib/configit/ConfigIt | 761 ++ contrib/configit/README | 32 + contrib/configit/TODO | 9 + contrib/crunch/COPYRIGHT | 25 + contrib/crunch/Makefile | 4 + contrib/crunch/Makefile.inc | 2 + contrib/crunch/README | 88 + contrib/crunch/crunchgen/Makefile | 9 + contrib/crunch/crunchgen/crunched_main.c | 102 + contrib/crunch/crunchgen/crunchgen.1 | 266 + contrib/crunch/crunchgen/crunchgen.c | 856 ++ contrib/crunch/crunchgen/mkskel.sh | 15 + contrib/crunch/crunchide/Makefile | 4 + contrib/crunch/crunchide/crunchide.1 | 68 + contrib/crunch/crunchide/crunchide.c | 321 + contrib/crunch/examples/Makefile | 32 + contrib/crunch/examples/filesystem.conf | 26 + contrib/crunch/examples/fixit.conf | 41 + contrib/crunch/examples/kcopy.conf | 18 + contrib/crunch/examples/really-big.conf | 146 + contrib/manctl/Makefile | 11 + contrib/manctl/manctl.sh | 376 + contrib/tcpdump/tcpdump/tcpdump.1 | 2 +- contrib/tcpdump/tcpslice/tcpslice.1 | 2 +- contrib/xntpd/COPYRIGHT | 6 +- contrib/xntpd/Makefile.inc | 4 +- contrib/xntpd/README.FreeBSD | 76 +- contrib/xntpd/RELNOTES | 6 + contrib/xntpd/VERSION | 2 +- contrib/xntpd/authstuff/authspeed.c | 2 +- contrib/xntpd/conf/Config.local | 4 +- contrib/xntpd/conf/Config.plain | 190 + contrib/xntpd/doc/README.kern | 1887 ++-- contrib/xntpd/doc/notes.txt | 2 +- contrib/xntpd/gadget/.keep_me | 0 contrib/xntpd/hints/.keep_me | 0 contrib/xntpd/include/l_stdlib.h | 8 +- contrib/xntpd/include/ntp.h | 30 +- contrib/xntpd/include/ntp_control.h | 1 + contrib/xntpd/include/ntp_if.h | 4 + contrib/xntpd/include/ntp_in.h | 259 + contrib/xntpd/include/ntp_io.h | 1 + contrib/xntpd/include/ntp_machine.h | 82 +- contrib/xntpd/include/ntp_request.h | 95 +- contrib/xntpd/include/ntp_stdlib.h | 1 + contrib/xntpd/include/ntp_timex.h | 277 +- contrib/xntpd/include/ntpd.h | 13 +- contrib/xntpd/include/parse.h | 78 +- contrib/xntpd/kernel/.keep_me | 0 contrib/xntpd/lib/Makefile | 4 +- contrib/xntpd/lib/clocktypes.c | 2 +- contrib/xntpd/lib/netof.c | 25 + contrib/xntpd/lib/numtohost.c | 5 +- contrib/xntpd/lib/systime.c | 3 +- contrib/xntpd/machines/.keep_me | 0 contrib/xntpd/ntpdate/ntpdate.h | 4 + contrib/xntpd/ntpq/ntpq.c | 74 +- contrib/xntpd/parse/README.new_clocks | 212 + contrib/xntpd/parse/README.parse_clocks | 263 + contrib/xntpd/parse/clk_dcf7000.c | 7 +- contrib/xntpd/parse/clk_meinberg.c | 22 +- contrib/xntpd/parse/clk_rawdcf.c | 16 +- contrib/xntpd/parse/clk_schmid.c | 12 +- contrib/xntpd/parse/clk_trimble.c | 5 +- contrib/xntpd/parse/parse.c | 35 +- contrib/xntpd/parse/parse_conf.c | 7 +- contrib/xntpd/parse/parsesolaris.c | 35 +- contrib/xntpd/parse/parsestreams.c | 78 +- contrib/xntpd/parse/util/parsetest.c | 18 +- contrib/xntpd/parse/util/testdcf.c | 4 +- contrib/xntpd/ppsclock/ppstest/.keep_me | 0 contrib/xntpd/ppsclock/sys/genassym/.keep_me | 0 contrib/xntpd/ppsclock/sys/os/.keep_me | 0 contrib/xntpd/ppsclock/sys/sun/.keep_me | 0 contrib/xntpd/ppsclock/sys/sun4c/.keep_me | 0 .../xntpd/ppsclock/sys/sun4c/conf/.keep_me | 0 .../xntpd/ppsclock/sys/sun4m/conf/.keep_me | 0 contrib/xntpd/ppsclock/sys/sundev/.keep_me | 0 contrib/xntpd/ppsclock/sys/sys/.keep_me | 0 contrib/xntpd/refclocks/rclk.TRAK | 29 + contrib/xntpd/scripts/Guess.sh | 8 +- contrib/xntpd/scripts/README | 2 +- contrib/xntpd/scripts/stats/README | 35 +- contrib/xntpd/scripts/stats/dupe.awk | 3 +- contrib/xntpd/scripts/stats/ensemble.S | 5 + contrib/xntpd/scripts/stats/etf.S | 15 + contrib/xntpd/scripts/stats/itf.S | 5 + contrib/xntpd/scripts/stats/loop.S | 7 + contrib/xntpd/scripts/stats/loop.awk | 10 +- contrib/xntpd/scripts/stats/psummary.awk | 2 + contrib/xntpd/scripts/stats/rms.awk | 41 + contrib/xntpd/scripts/stats/summary.sh | 93 +- contrib/xntpd/scripts/stats/tdata.S | 5 + contrib/xntpd/scripts/support/bin/monl | 3 +- contrib/xntpd/util/ntptime.c | 85 +- contrib/xntpd/util/tickadj.c | 71 +- contrib/xntpd/xntpd/Makefile | 4 +- .../xntpd/{adjtime/.keep_me => xntpd/minpoll} | 0 contrib/xntpd/xntpd/ntp_config.c | 201 +- contrib/xntpd/xntpd/ntp_control.c | 35 +- contrib/xntpd/xntpd/ntp_intres.c | 15 +- contrib/xntpd/xntpd/ntp_io.c | 95 +- contrib/xntpd/xntpd/ntp_loopfilter.c | 252 +- contrib/xntpd/xntpd/ntp_monitor.c | 51 +- contrib/xntpd/xntpd/ntp_peer.c | 26 +- contrib/xntpd/xntpd/ntp_proto.c | 225 +- contrib/xntpd/xntpd/ntp_refclock.c | 30 +- contrib/xntpd/xntpd/ntp_request.c | 175 +- contrib/xntpd/xntpd/ntp_restrict.c | 166 +- contrib/xntpd/xntpd/ntp_unixclock.c | 32 +- contrib/xntpd/xntpd/ntpd.c | 20 +- contrib/xntpd/xntpd/refclock_chu.c | 19 + contrib/xntpd/xntpd/refclock_conf.c | 8 +- contrib/xntpd/xntpd/refclock_irig.c | 6 +- contrib/xntpd/xntpd/refclock_msfees.c | 2 +- contrib/xntpd/xntpd/refclock_parse.c | 103 +- contrib/xntpd/xntpd/refclock_trak.c | 1006 ++ contrib/xntpd/xntpdc/ntpdc.c | 12 +- contrib/xntpd/xntpdc/ntpdc_ops.c | 297 +- contrib/xntpd/xntpres/xntpres.c | 18 +- etc/Makefile | 402 +- etc/crontab | 2 +- etc/csh.login | 4 +- etc/daily | 25 +- etc/etc.i386/EXTRACT_bin.sh | 18 + etc/etc.i386/EXTRACT_secr.sh | 15 + etc/etc.i386/EXTRACT_src.sh | 41 + etc/etc.i386/MAKEDEV | 152 +- .../{floppy.install_notes => README.1ST} | 9 +- .../{install_notes => README.INSTALL} | 208 +- etc/etc.i386/cdinst1.install | 15 +- etc/etc.i386/cpio.magic | 48 +- etc/etc.i386/cpio.rc | 13 +- etc/etc.i386/inst1.install | 14 +- etc/etc.i386/inst2.rc | 4 +- etc/group | 1 + etc/hosts | 16 +- etc/inetd.conf | 2 +- etc/kerberosIV/README | 35 + etc/kerberosIV/krb.conf | 9 + etc/kerberosIV/krb.realms | 3 + etc/login.access | 44 + etc/make.conf | 71 + etc/master.passwd | 2 +- etc/minfree | 1 + etc/mtree/BSD.local.dist | 20 +- etc/mtree/BSD.root.dist | 8 +- etc/mtree/BSD.usr.dist | 4 +- etc/mtree/BSD.var.dist | 7 +- etc/netstart | 5 +- etc/rc | 26 +- etc/rc.local | 2 +- etc/rc.serial | 91 + etc/root/dot.login | 4 +- etc/root/dot.profile | 6 +- etc/services | 2 +- etc/skey.access | 8 + etc/termcap.small | 154 + etc/ttys | 14 +- games/Makefile | 2 +- games/fortune/fortune/fortune.c | 2 +- games/hack/COPYRIGHT | 6 - games/hack/Makefile | 40 - games/hack/Makequest | 196 - games/hack/OWNER | 2 - games/hack/Original_READ_ME | 61 - games/hack/READ_ME | 92 - games/hack/alloc.c | 47 - games/hack/config.h | 139 - games/hack/data | 232 - games/hack/date.h | 2 - games/hack/def.edog.h | 12 - games/hack/def.eshk.h | 24 - games/hack/def.flag.h | 42 - games/hack/def.func_tab.h | 16 - games/hack/def.gen.h | 15 - games/hack/def.gold.h | 12 - games/hack/def.mkroom.h | 26 - games/hack/def.monst.h | 60 - games/hack/def.obj.h | 48 - games/hack/def.objclass.h | 60 - games/hack/def.objects.h | 289 - games/hack/def.permonst.h | 25 - games/hack/def.rm.h | 52 - games/hack/def.trap.h | 27 - games/hack/def.wseg.h | 13 - games/hack/hack.6 | 155 - games/hack/hack.Decl.c | 43 - games/hack/hack.apply.c | 437 - games/hack/hack.bones.c | 95 - games/hack/hack.c | 798 -- games/hack/hack.cmd.c | 302 - games/hack/hack.do.c | 488 - games/hack/hack.do_name.c | 289 - games/hack/hack.do_wear.c | 336 - games/hack/hack.dog.c | 413 - games/hack/hack.eat.c | 459 - games/hack/hack.end.c | 642 -- games/hack/hack.engrave.c | 306 - games/hack/hack.fight.c | 358 - games/hack/hack.fix | 113 - games/hack/hack.h | 160 - games/hack/hack.invent.c | 863 -- games/hack/hack.ioctl.c | 53 - games/hack/hack.lev.c | 285 - games/hack/hack.main.c | 499 - games/hack/hack.makemon.c | 198 - games/hack/hack.mfndpos.h | 12 - games/hack/hack.mhitu.c | 363 - games/hack/hack.mklev.c | 741 -- games/hack/hack.mkmaze.c | 136 - games/hack/hack.mkobj.c | 148 - games/hack/hack.mkshop.c | 274 - games/hack/hack.mon.c | 853 -- games/hack/hack.monst.c | 79 - games/hack/hack.o_init.c | 160 - games/hack/hack.objnam.c | 547 -- games/hack/hack.options.c | 203 - games/hack/hack.pager.c | 406 - games/hack/hack.potion.c | 386 - games/hack/hack.pri.c | 660 -- games/hack/hack.read.c | 539 -- games/hack/hack.rip.c | 81 - games/hack/hack.rumors.c | 63 - games/hack/hack.save.c | 238 - games/hack/hack.search.c | 133 - games/hack/hack.sh | 14 - games/hack/hack.shk.c | 987 -- games/hack/hack.shknam.c | 140 - games/hack/hack.steal.c | 203 - games/hack/hack.termcap.c | 276 - games/hack/hack.timeout.c | 62 - games/hack/hack.topl.c | 192 - games/hack/hack.track.c | 38 - games/hack/hack.trap.c | 447 - games/hack/hack.tty.c | 338 - games/hack/hack.u_init.c | 357 - games/hack/hack.unix.c | 430 - games/hack/hack.vault.c | 259 - games/hack/hack.version.c | 16 - games/hack/hack.wield.c | 99 - games/hack/hack.wizard.c | 189 - games/hack/hack.worm.c | 183 - games/hack/hack.worn.c | 65 - games/hack/hack.zap.c | 642 -- games/hack/help | 132 - games/hack/hh | 55 - games/hack/makedefs.c | 224 - games/hack/rnd.c | 30 - games/hack/rumors | 505 - games/monop/Makefile | 2 +- games/monop/misc.c | 2 + games/sail/dr_main.c | 2 +- gnu/lib/Makefile | 4 +- gnu/lib/Makefile.inc | 8 +- gnu/lib/libg++/Makefile | 26 +- gnu/lib/libg++/Makefile.inc | 10 +- .../libg++/g++-include/{gen => }/AVLMap.ccP | 0 .../libg++/g++-include/{gen => }/AVLMap.hP | 0 .../libg++/g++-include/{gen => }/AVLSet.ccP | 0 .../libg++/g++-include/{gen => }/AVLSet.hP | 0 gnu/lib/libg++/g++-include/{gen => }/AVec.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/AVec.hP | 0 .../libg++/g++-include/{gen => }/BSTSet.ccP | 0 .../libg++/g++-include/{gen => }/BSTSet.hP | 0 gnu/lib/libg++/g++-include/{gen => }/Bag.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Bag.hP | 0 .../libg++/g++-include/{gen => }/CHBag.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/CHBag.hP | 0 .../libg++/g++-include/{gen => }/CHMap.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/CHMap.hP | 0 .../libg++/g++-include/{gen => }/CHNode.ccP | 0 .../libg++/g++-include/{gen => }/CHNode.hP | 0 .../libg++/g++-include/{gen => }/CHSet.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/CHSet.hP | 0 .../libg++/g++-include/{gen => }/DLDeque.ccP | 0 .../libg++/g++-include/{gen => }/DLDeque.hP | 0 .../libg++/g++-include/{gen => }/DLList.ccP | 0 .../libg++/g++-include/{gen => }/DLList.hP | 0 .../libg++/g++-include/{gen => }/Deque.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Deque.hP | 0 .../libg++/g++-include/{gen => }/FPQueue.ccP | 0 .../libg++/g++-include/{gen => }/FPQueue.hP | 0 .../libg++/g++-include/{gen => }/FPStack.ccP | 0 .../libg++/g++-include/{gen => }/FPStack.hP | 0 .../libg++/g++-include/{gen => }/FPlex.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/FPlex.hP | 0 gnu/lib/libg++/g++-include/{gen => }/List.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/List.hP | 0 .../libg++/g++-include/{gen => }/MPlex.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/MPlex.hP | 0 gnu/lib/libg++/g++-include/{gen => }/Map.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Map.hP | 0 .../libg++/g++-include/{gen => }/OSLBag.ccP | 0 .../libg++/g++-include/{gen => }/OSLBag.hP | 0 .../libg++/g++-include/{gen => }/OSLSet.ccP | 0 .../libg++/g++-include/{gen => }/OSLSet.hP | 0 .../libg++/g++-include/{gen => }/OXPBag.ccP | 0 .../libg++/g++-include/{gen => }/OXPBag.hP | 0 .../libg++/g++-include/{gen => }/OXPSet.ccP | 0 .../libg++/g++-include/{gen => }/OXPSet.hP | 0 gnu/lib/libg++/g++-include/{gen => }/PHPQ.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/PHPQ.hP | 0 gnu/lib/libg++/g++-include/{gen => }/PQ.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/PQ.hP | 0 .../libg++/g++-include/{gen => }/PSList.hP | 0 gnu/lib/libg++/g++-include/{gen => }/PVec.hP | 0 gnu/lib/libg++/g++-include/{gen => }/Plex.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Plex.hP | 0 .../libg++/g++-include/{gen => }/Queue.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Queue.hP | 0 .../libg++/g++-include/{gen => }/RAVLMap.ccP | 0 .../libg++/g++-include/{gen => }/RAVLMap.hP | 0 .../libg++/g++-include/{gen => }/RPlex.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/RPlex.hP | 0 .../libg++/g++-include/{gen => }/SLBag.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/SLBag.hP | 0 .../libg++/g++-include/{gen => }/SLList.ccP | 0 .../libg++/g++-include/{gen => }/SLList.hP | 0 .../libg++/g++-include/{gen => }/SLQueue.ccP | 0 .../libg++/g++-include/{gen => }/SLQueue.hP | 0 .../libg++/g++-include/{gen => }/SLSet.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/SLSet.hP | 0 .../libg++/g++-include/{gen => }/SLStack.ccP | 0 .../libg++/g++-include/{gen => }/SLStack.hP | 0 gnu/lib/libg++/g++-include/{gen => }/Set.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Set.hP | 0 .../libg++/g++-include/{gen => }/SkipBag.ccP | 0 .../libg++/g++-include/{gen => }/SkipBag.hP | 0 .../libg++/g++-include/{gen => }/SkipMap.ccP | 0 .../libg++/g++-include/{gen => }/SkipMap.hP | 0 .../libg++/g++-include/{gen => }/SkipSet.ccP | 0 .../libg++/g++-include/{gen => }/SkipSet.hP | 0 .../libg++/g++-include/{gen => }/SplayBag.ccP | 0 .../libg++/g++-include/{gen => }/SplayBag.hP | 0 .../libg++/g++-include/{gen => }/SplayMap.ccP | 0 .../libg++/g++-include/{gen => }/SplayMap.hP | 0 .../g++-include/{gen => }/SplayNode.ccP | 0 .../libg++/g++-include/{gen => }/SplayNode.hP | 0 .../libg++/g++-include/{gen => }/SplayPQ.ccP | 0 .../libg++/g++-include/{gen => }/SplayPQ.hP | 0 .../libg++/g++-include/{gen => }/SplaySet.ccP | 0 .../libg++/g++-include/{gen => }/SplaySet.hP | 0 .../libg++/g++-include/{gen => }/Stack.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Stack.hP | 0 .../libg++/g++-include/{gen => }/VHBag.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/VHBag.hP | 0 .../libg++/g++-include/{gen => }/VHMap.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/VHMap.hP | 0 .../libg++/g++-include/{gen => }/VHSet.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/VHSet.hP | 0 .../libg++/g++-include/{gen => }/VOHSet.ccP | 0 .../libg++/g++-include/{gen => }/VOHSet.hP | 0 .../libg++/g++-include/{gen => }/VQueue.ccP | 0 .../libg++/g++-include/{gen => }/VQueue.hP | 0 .../libg++/g++-include/{gen => }/VStack.ccP | 0 .../libg++/g++-include/{gen => }/VStack.hP | 0 gnu/lib/libg++/g++-include/{gen => }/Vec.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/Vec.hP | 0 .../libg++/g++-include/{gen => }/XPBag.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/XPBag.hP | 0 .../libg++/g++-include/{gen => }/XPDeque.ccP | 0 .../libg++/g++-include/{gen => }/XPDeque.hP | 0 gnu/lib/libg++/g++-include/{gen => }/XPPQ.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/XPPQ.hP | 0 .../libg++/g++-include/{gen => }/XPQueue.ccP | 0 .../libg++/g++-include/{gen => }/XPQueue.hP | 0 .../libg++/g++-include/{gen => }/XPSet.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/XPSet.hP | 0 .../libg++/g++-include/{gen => }/XPStack.ccP | 0 .../libg++/g++-include/{gen => }/XPStack.hP | 0 .../libg++/g++-include/{gen => }/XPlex.ccP | 0 gnu/lib/libg++/g++-include/{gen => }/XPlex.hP | 0 gnu/lib/libg++/g++-include/assert.h | 14 - gnu/lib/libg++/g++-include/bstring.h | 1 - gnu/lib/libg++/g++-include/ctype.h | 10 - gnu/lib/libg++/g++-include/curses.h | 82 - gnu/lib/libg++/g++-include/{gen => }/defs.hP | 0 gnu/lib/libg++/g++-include/dir.h | 1 - gnu/lib/libg++/g++-include/dirent.h | 44 - gnu/lib/libg++/g++-include/errno.h | 24 - gnu/lib/libg++/g++-include/fcntl.h | 29 - gnu/lib/libg++/g++-include/grp.h | 41 - .../libg++/g++-include/{gen => }/intSList.hP | 0 .../libg++/g++-include/{gen => }/intVec.hP | 0 gnu/lib/libg++/g++-include/math.h | 221 - gnu/lib/libg++/g++-include/memory.h | 42 - gnu/lib/libg++/g++-include/netdb.h | 4 - gnu/lib/libg++/g++-include/pwd.h | 36 - gnu/lib/libg++/g++-include/setjmp.h | 29 - gnu/lib/libg++/g++-include/signal.h | 80 - gnu/lib/libg++/g++-include/stdarg.h | 3 - gnu/lib/libg++/g++-include/stddef.h | 12 - gnu/lib/libg++/g++-include/stdio.h | 180 - gnu/lib/libg++/g++-include/stdlib.h | 81 - gnu/lib/libg++/g++-include/string.h | 45 - gnu/lib/libg++/g++-include/strings.h | 1 - gnu/lib/libg++/g++-include/sys/dir.h | 42 - gnu/lib/libg++/g++-include/sys/fcntl.h | 15 - gnu/lib/libg++/g++-include/sys/file.h | 28 - gnu/lib/libg++/g++-include/sys/mman.h | 14 - gnu/lib/libg++/g++-include/sys/param.h | 22 - gnu/lib/libg++/g++-include/sys/resource.h | 29 - gnu/lib/libg++/g++-include/sys/select.h | 8 - gnu/lib/libg++/g++-include/sys/signal.h | 37 - gnu/lib/libg++/g++-include/sys/socket.h | 63 - gnu/lib/libg++/g++-include/sys/stat.h | 47 - gnu/lib/libg++/g++-include/sys/time.h | 41 - gnu/lib/libg++/g++-include/sys/times.h | 20 - gnu/lib/libg++/g++-include/sys/types.h | 25 - gnu/lib/libg++/g++-include/sys/wait.h | 42 - gnu/lib/libg++/g++-include/time.h | 108 - gnu/lib/libg++/g++-include/unistd.h | 187 - .../libg++/{g++-include => include}/values.h | 11 +- gnu/lib/libg++/libg++/CursesW.cc | 2 +- gnu/lib/libg++/libg++/Makefile | 10 +- gnu/lib/libmalloc/Makefile | 4 +- gnu/lib/libreadline/COPYING | 257 + gnu/lib/libreadline/ChangeLog | 403 + gnu/lib/libreadline/Makefile | 25 + gnu/lib/libreadline/README | 6 + gnu/lib/libreadline/README.FreeBSD | 21 + gnu/lib/libreadline/STANDALONE | 32 + gnu/lib/libreadline/VERSION | 1 + gnu/lib/libreadline/ansi_stdlib.h | 41 + gnu/lib/libreadline/bind.c | 1476 +++ gnu/lib/libreadline/complete.c | 1381 +++ gnu/lib/libreadline/display.c | 1017 ++ gnu/lib/libreadline/doc/Makefile | 34 + gnu/lib/libreadline/doc/hist.texinfo | 106 + gnu/lib/libreadline/doc/hstech.texinfo | 308 + gnu/lib/libreadline/doc/hsuser.texinfo | 197 + gnu/lib/libreadline/doc/rlman.texinfo | 103 + gnu/lib/libreadline/doc/rltech.texinfo | 1012 ++ gnu/lib/libreadline/doc/rluser.texinfo | 865 ++ gnu/lib/libreadline/doc/texindex.c | 1666 ++++ gnu/lib/libreadline/emacs_keymap.c | 885 ++ gnu/lib/libreadline/examples/Inputrc | 58 + gnu/lib/libreadline/examples/Makefile | 12 + gnu/lib/libreadline/examples/fileman.c | 395 + gnu/lib/libreadline/examples/manexamp.c | 96 + .../gdb/readline => lib/libreadline}/funmap.c | 272 +- gnu/lib/libreadline/history.c | 2136 ++++ gnu/lib/libreadline/isearch.c | 372 + .../readline => lib/libreadline}/keymaps.c | 61 +- gnu/lib/libreadline/memalloc.h | 56 + gnu/lib/libreadline/parens.c | 118 + gnu/lib/libreadline/posixstat.h | 149 + gnu/lib/libreadline/readline.c | 3349 +++++++ gnu/lib/libreadline/readline/chardefs.h | 89 + .../libreadline}/readline/history.h | 43 +- gnu/lib/libreadline/readline/keymaps.h | 91 + gnu/lib/libreadline/readline/readline.h | 267 + gnu/lib/libreadline/readline/tilde.h | 38 + gnu/lib/libreadline/rlconf.h | 57 + gnu/lib/libreadline/rldefs.h | 190 + gnu/lib/libreadline/rltty.c | 693 ++ gnu/lib/libreadline/search.c | 360 + gnu/lib/libreadline/signals.c | 303 + gnu/lib/libreadline/tcsh_hack.readme | 27 + gnu/lib/libreadline/tilde.c | 386 + gnu/lib/libreadline/vi_keymap.c | 877 ++ gnu/lib/libreadline/vi_mode.c | 1319 +++ gnu/lib/libreadline/xmalloc.c | 78 + gnu/lib/libregex/Makefile | 7 +- gnu/libexec/uucp/ChangeLog | 1669 +++- gnu/libexec/uucp/Makefile.inc | 4 +- gnu/libexec/uucp/NEWS | 119 + gnu/libexec/uucp/README | 107 +- gnu/libexec/uucp/TODO | 265 +- gnu/libexec/uucp/VERSION | 2 +- gnu/libexec/uucp/common_sources/chat.c | 61 +- .../uucp/common_sources/{conf.h => config.h} | 92 +- gnu/libexec/uucp/common_sources/conn.c | 281 +- gnu/libexec/uucp/common_sources/conn.h | 25 +- gnu/libexec/uucp/common_sources/copy.c | 4 +- gnu/libexec/uucp/common_sources/cu.h | 2 +- gnu/libexec/uucp/common_sources/log.c | 224 +- gnu/libexec/uucp/common_sources/policy.h | 205 +- gnu/libexec/uucp/common_sources/prot.c | 10 +- gnu/libexec/uucp/common_sources/prot.h | 7 +- gnu/libexec/uucp/common_sources/sysdep.h | 50 +- gnu/libexec/uucp/common_sources/system.h | 87 +- gnu/libexec/uucp/common_sources/tcp.c | 53 +- gnu/libexec/uucp/common_sources/tli.c | 116 +- gnu/libexec/uucp/common_sources/trans.h | 24 +- gnu/libexec/uucp/common_sources/util.c | 50 +- gnu/libexec/uucp/common_sources/uuconf.h | 60 +- gnu/libexec/uucp/common_sources/uucp.h | 37 +- gnu/libexec/uucp/common_sources/uudefs.h | 25 +- gnu/libexec/uucp/contrib/Makefile.uurt | 36 +- gnu/libexec/uucp/contrib/README | 44 +- gnu/libexec/uucp/contrib/README-UURATE | 17 +- gnu/libexec/uucp/contrib/amiga.c | 43 + gnu/libexec/uucp/contrib/dialHDB.c | 187 + gnu/libexec/uucp/contrib/uucomp.shar | 552 ++ gnu/libexec/uucp/contrib/uudemon.shar | 82 + gnu/libexec/uucp/contrib/uupoll.shar | 2696 ++++++ gnu/libexec/uucp/contrib/uurate.c | 2241 ++++- gnu/libexec/uucp/contrib/uurate.man | 261 +- gnu/libexec/uucp/contrib/uureroute.perl | 91 + gnu/libexec/uucp/contrib/uusnap.c | 2 +- gnu/libexec/uucp/contrib/uutraf | 35 +- gnu/libexec/uucp/contrib/uuxconv | 50 + gnu/libexec/uucp/contrib/xchat.c | 109 +- gnu/libexec/uucp/contrib/xchat.man | 14 + gnu/libexec/uucp/cu/Makefile | 4 +- gnu/libexec/uucp/cu/cu.1 | 65 +- gnu/libexec/uucp/cu/cu.c | 157 +- gnu/libexec/uucp/doc/uucp.texi | 4036 ++++++++ gnu/libexec/uucp/libunix/MANIFEST | 5 +- gnu/libexec/uucp/libunix/Makefile | 21 +- gnu/libexec/uucp/libunix/app3.c | 5 +- gnu/libexec/uucp/libunix/app4.c | 5 +- gnu/libexec/uucp/libunix/cohtty.c | 21 +- gnu/libexec/uucp/libunix/corrup.c | 33 + gnu/libexec/uucp/libunix/cusub.c | 64 +- gnu/libexec/uucp/libunix/cwd.c | 7 +- gnu/libexec/uucp/libunix/detach.c | 10 +- gnu/libexec/uucp/libunix/dirent.c | 2 +- gnu/libexec/uucp/libunix/dup2.c | 2 +- gnu/libexec/uucp/libunix/epopen.c | 4 +- gnu/libexec/uucp/libunix/filnam.c | 6 +- gnu/libexec/uucp/libunix/fsusg.c | 128 +- gnu/libexec/uucp/libunix/ftw.c | 12 +- gnu/libexec/uucp/libunix/indir.c | 2 +- gnu/libexec/uucp/libunix/init.c | 28 +- gnu/libexec/uucp/libunix/iswait.c | 2 +- gnu/libexec/uucp/libunix/jobid.c | 2 +- gnu/libexec/uucp/libunix/lcksys.c | 35 +- gnu/libexec/uucp/libunix/locfil.c | 12 +- gnu/libexec/uucp/libunix/lock.c | 279 +- gnu/libexec/uucp/libunix/loctim.c | 4 +- gnu/libexec/uucp/libunix/mail.c | 52 +- gnu/libexec/uucp/libunix/mkdir.c | 2 +- gnu/libexec/uucp/libunix/mkdirs.c | 20 +- gnu/libexec/uucp/libunix/move.c | 24 +- gnu/libexec/uucp/libunix/opensr.c | 24 +- gnu/libexec/uucp/libunix/pause.c | 10 +- gnu/libexec/uucp/libunix/picksb.c | 14 +- gnu/libexec/uucp/libunix/pipe.c | 294 + gnu/libexec/uucp/libunix/priv.c | 24 + gnu/libexec/uucp/libunix/proctm.c | 6 +- gnu/libexec/uucp/libunix/recep.c | 12 +- gnu/libexec/uucp/libunix/run.c | 52 +- gnu/libexec/uucp/libunix/seq.c | 4 +- gnu/libexec/uucp/libunix/serial.c | 666 +- gnu/libexec/uucp/libunix/signal.c | 2 +- gnu/libexec/uucp/libunix/sindir.c | 5 +- gnu/libexec/uucp/libunix/sleep.c | 12 + gnu/libexec/uucp/libunix/spawn.c | 55 +- gnu/libexec/uucp/libunix/splcmd.c | 44 +- gnu/libexec/uucp/libunix/spool.c | 43 +- gnu/libexec/uucp/libunix/srmdir.c | 6 +- gnu/libexec/uucp/libunix/statsb.c | 126 +- gnu/libexec/uucp/libunix/status.c | 6 +- gnu/libexec/uucp/libunix/strerr.c | 2 + gnu/libexec/uucp/libunix/tmpfil.c | 5 +- gnu/libexec/uucp/libunix/uacces.c | 2 +- gnu/libexec/uucp/libunix/ufopen.c | 2 +- gnu/libexec/uucp/libunix/walk.c | 5 +- gnu/libexec/uucp/libunix/wldcrd.c | 7 +- gnu/libexec/uucp/libunix/work.c | 92 +- gnu/libexec/uucp/libunix/xqtfil.c | 11 +- gnu/libexec/uucp/libunix/xqtsub.c | 32 +- gnu/libexec/uucp/libuuconf/MANIFEST | 1 + gnu/libexec/uucp/libuuconf/Makefile | 26 +- gnu/libexec/uucp/libuuconf/README | 4 +- gnu/libexec/uucp/libuuconf/addblk.c | 4 +- gnu/libexec/uucp/libuuconf/addstr.c | 4 +- gnu/libexec/uucp/libuuconf/allblk.c | 4 +- gnu/libexec/uucp/libuuconf/alloc.c | 4 +- gnu/libexec/uucp/libuuconf/alloc.h | 2 +- gnu/libexec/uucp/libuuconf/base.c | 4 +- gnu/libexec/uucp/libuuconf/bool.c | 4 +- gnu/libexec/uucp/libuuconf/callin.c | 118 +- gnu/libexec/uucp/libuuconf/calout.c | 4 +- gnu/libexec/uucp/libuuconf/chatc.c | 4 +- gnu/libexec/uucp/libuuconf/cmdarg.c | 4 +- gnu/libexec/uucp/libuuconf/cmdfil.c | 9 +- gnu/libexec/uucp/libuuconf/cmdlin.c | 4 +- gnu/libexec/uucp/libuuconf/debfil.c | 4 +- gnu/libexec/uucp/libuuconf/deblev.c | 4 +- gnu/libexec/uucp/libuuconf/diacod.c | 6 +- gnu/libexec/uucp/libuuconf/dial.c | 4 +- gnu/libexec/uucp/libuuconf/diasub.c | 4 +- gnu/libexec/uucp/libuuconf/dnams.c | 4 +- gnu/libexec/uucp/libuuconf/errno.c | 4 +- gnu/libexec/uucp/libuuconf/errstr.c | 4 +- gnu/libexec/uucp/libuuconf/filnam.c | 6 +- gnu/libexec/uucp/libuuconf/freblk.c | 4 +- gnu/libexec/uucp/libuuconf/fredia.c | 4 +- gnu/libexec/uucp/libuuconf/free.c | 4 +- gnu/libexec/uucp/libuuconf/freprt.c | 4 +- gnu/libexec/uucp/libuuconf/fresys.c | 4 +- gnu/libexec/uucp/libuuconf/grdcmp.c | 4 +- gnu/libexec/uucp/libuuconf/hdial.c | 4 +- gnu/libexec/uucp/libuuconf/hdnams.c | 4 +- gnu/libexec/uucp/libuuconf/hinit.c | 8 +- gnu/libexec/uucp/libuuconf/hlocnm.c | 4 +- gnu/libexec/uucp/libuuconf/hport.c | 46 +- gnu/libexec/uucp/libuuconf/hrmunk.c | 4 +- gnu/libexec/uucp/libuuconf/hsinfo.c | 17 +- gnu/libexec/uucp/libuuconf/hsnams.c | 4 +- gnu/libexec/uucp/libuuconf/hsys.c | 4 +- gnu/libexec/uucp/libuuconf/hunk.c | 4 +- gnu/libexec/uucp/libuuconf/iniglb.c | 7 +- gnu/libexec/uucp/libuuconf/init.c | 4 +- gnu/libexec/uucp/libuuconf/int.c | 4 +- gnu/libexec/uucp/libuuconf/lckdir.c | 4 +- gnu/libexec/uucp/libuuconf/lineno.c | 4 +- gnu/libexec/uucp/libuuconf/llocnm.c | 15 +- gnu/libexec/uucp/libuuconf/local.c | 4 +- gnu/libexec/uucp/libuuconf/locnm.c | 4 +- gnu/libexec/uucp/libuuconf/logfil.c | 4 +- gnu/libexec/uucp/libuuconf/maxuxq.c | 4 +- gnu/libexec/uucp/libuuconf/mrgblk.c | 4 +- gnu/libexec/uucp/libuuconf/paramc.c | 4 +- gnu/libexec/uucp/libuuconf/port.c | 4 +- gnu/libexec/uucp/libuuconf/prtsub.c | 4 +- gnu/libexec/uucp/libuuconf/pubdir.c | 4 +- gnu/libexec/uucp/libuuconf/rdlocs.c | 4 +- gnu/libexec/uucp/libuuconf/rdperm.c | 36 +- gnu/libexec/uucp/libuuconf/reliab.c | 4 +- gnu/libexec/uucp/libuuconf/remunk.c | 19 +- gnu/libexec/uucp/libuuconf/runuxq.c | 77 + gnu/libexec/uucp/libuuconf/sinfo.c | 4 +- gnu/libexec/uucp/libuuconf/snams.c | 4 +- gnu/libexec/uucp/libuuconf/split.c | 4 +- gnu/libexec/uucp/libuuconf/spool.c | 4 +- gnu/libexec/uucp/libuuconf/stafil.c | 4 +- gnu/libexec/uucp/libuuconf/syshdr.h | 38 +- gnu/libexec/uucp/libuuconf/syssub.c | 71 +- gnu/libexec/uucp/libuuconf/tcalou.c | 16 +- gnu/libexec/uucp/libuuconf/tdial.c | 4 +- gnu/libexec/uucp/libuuconf/tdialc.c | 4 +- gnu/libexec/uucp/libuuconf/tdnams.c | 4 +- gnu/libexec/uucp/libuuconf/tgcmp.c | 4 +- gnu/libexec/uucp/libuuconf/thread.c | 4 +- gnu/libexec/uucp/libuuconf/time.c | 9 +- gnu/libexec/uucp/libuuconf/tinit.c | 123 +- gnu/libexec/uucp/libuuconf/tlocnm.c | 4 +- gnu/libexec/uucp/libuuconf/tport.c | 12 +- gnu/libexec/uucp/libuuconf/tportc.c | 78 +- gnu/libexec/uucp/libuuconf/tsinfo.c | 30 +- gnu/libexec/uucp/libuuconf/tsnams.c | 4 +- gnu/libexec/uucp/libuuconf/tsys.c | 4 +- gnu/libexec/uucp/libuuconf/tval.c | 4 +- gnu/libexec/uucp/libuuconf/ugtlin.c | 4 +- gnu/libexec/uucp/libuuconf/unk.c | 4 +- gnu/libexec/uucp/libuuconf/uucnfi.h | 12 +- gnu/libexec/uucp/libuuconf/val.c | 4 +- gnu/libexec/uucp/libuuconf/vinit.c | 4 +- gnu/libexec/uucp/libuuconf/vport.c | 9 +- gnu/libexec/uucp/libuuconf/vsinfo.c | 16 +- gnu/libexec/uucp/libuuconf/vsnams.c | 4 +- gnu/libexec/uucp/libuuconf/vsys.c | 4 +- gnu/libexec/uucp/libuucp/MANIFEST | 1 + gnu/libexec/uucp/libuucp/Makefile | 7 +- gnu/libexec/uucp/libuucp/buffer.c | 24 +- gnu/libexec/uucp/libuucp/debug.c | 10 +- gnu/libexec/uucp/libuucp/getlin.c | 2 +- gnu/libexec/uucp/libuucp/parse.c | 20 +- gnu/libexec/uucp/libuucp/status.c | 18 + gnu/libexec/uucp/libuucp/strtou.c | 21 + gnu/libexec/uucp/sample/Makefile | 6 +- gnu/libexec/uucp/sample/{call => call.sample} | 0 .../uucp/sample/{config => config.sample} | 0 gnu/libexec/uucp/sample/{dial => dial.sample} | 6 +- .../uucp/sample/{dialcode => dialcode.sample} | 0 .../uucp/sample/{passwd => passwd.sample} | 0 gnu/libexec/uucp/sample/{port => port.sample} | 0 gnu/libexec/uucp/sample/{sys1 => sys1.sample} | 0 gnu/libexec/uucp/sample/{sys2 => sys2.sample} | 0 gnu/libexec/uucp/tstuu.c | 25 +- gnu/libexec/uucp/uuchk/Makefile | 4 +- gnu/libexec/uucp/uuchk/uuchk.c | 149 +- gnu/libexec/uucp/uucico/Makefile | 6 +- gnu/libexec/uucp/uucico/prote.c | 4 +- gnu/libexec/uucp/uucico/protf.c | 14 +- gnu/libexec/uucp/uucico/protg.c | 83 +- gnu/libexec/uucp/uucico/proti.c | 263 +- gnu/libexec/uucp/uucico/protj.c | 7 +- gnu/libexec/uucp/uucico/prott.c | 7 +- gnu/libexec/uucp/uucico/protz.c | 4 +- gnu/libexec/uucp/uucico/rec.c | 238 +- gnu/libexec/uucp/uucico/send.c | 271 +- gnu/libexec/uucp/uucico/time.c | 10 +- gnu/libexec/uucp/uucico/trans.c | 118 +- gnu/libexec/uucp/uucico/uucico.8 | 176 +- gnu/libexec/uucp/uucico/uucico.c | 774 +- gnu/libexec/uucp/uucico/xcmd.c | 31 +- gnu/libexec/uucp/uuconv/Makefile | 4 +- gnu/libexec/uucp/uuconv/uuconv.c | 142 +- gnu/libexec/uucp/uucp/Makefile | 4 +- gnu/libexec/uucp/uucp/uucp.1 | 55 +- gnu/libexec/uucp/uucp/uucp.c | 190 +- gnu/libexec/uucp/uulog/uulog.c | 142 +- gnu/libexec/uucp/uuname/uuname.c | 88 +- gnu/libexec/uucp/uupick/uupick.c | 81 +- gnu/libexec/uucp/uusched/uusched.in | 6 +- gnu/libexec/uucp/uustat/uustat.1 | 408 +- gnu/libexec/uucp/uustat/uustat.c | 397 +- gnu/libexec/uucp/uuto/uuto.in | 6 +- gnu/libexec/uucp/uux/Makefile | 4 +- gnu/libexec/uucp/uux/uux.1 | 97 +- gnu/libexec/uucp/uux/uux.c | 299 +- gnu/libexec/uucp/uuxqt/Makefile | 7 +- gnu/libexec/uucp/uuxqt/uuxqt.8 | 37 +- gnu/libexec/uucp/uuxqt/uuxqt.c | 292 +- gnu/usr.bin/Makefile | 6 +- gnu/usr.bin/awk/ACKNOWLEDGMENT | 8 +- gnu/usr.bin/awk/FUTURES | 69 +- gnu/usr.bin/awk/LIMITATIONS | 2 + gnu/usr.bin/awk/Makefile | 20 +- gnu/usr.bin/awk/NEWS | 207 +- gnu/usr.bin/awk/PORTS | 9 +- gnu/usr.bin/awk/PROBLEMS | 6 +- gnu/usr.bin/awk/README | 25 +- gnu/usr.bin/awk/array.c | 300 +- gnu/usr.bin/awk/awk.1 | 158 +- gnu/usr.bin/awk/awk.h | 115 +- gnu/usr.bin/awk/awk.y | 144 +- gnu/usr.bin/awk/builtin.c | 676 +- gnu/usr.bin/awk/config.h | 38 +- gnu/usr.bin/awk/dfa.c | 2803 +++--- gnu/usr.bin/awk/dfa.h | 425 +- gnu/usr.bin/awk/eval.c | 117 +- gnu/usr.bin/awk/field.c | 119 +- gnu/usr.bin/awk/getopt.c | 203 +- gnu/usr.bin/awk/getopt.h | 31 +- gnu/usr.bin/awk/getopt1.c | 75 +- gnu/usr.bin/awk/io.c | 221 +- gnu/usr.bin/awk/iop.c | 27 +- gnu/usr.bin/awk/main.c | 178 +- gnu/usr.bin/awk/msg.c | 11 +- gnu/usr.bin/awk/node.c | 68 +- gnu/usr.bin/awk/patchlevel.h | 2 +- gnu/usr.bin/awk/protos.h | 45 +- gnu/usr.bin/awk/re.c | 46 +- gnu/usr.bin/awk/regex.c | 6564 ++++++++----- gnu/usr.bin/awk/regex.h | 661 +- gnu/usr.bin/awk/version.c | 3 +- gnu/usr.bin/cc/cc/gcc.c | 6 +- gnu/usr.bin/cc/cpp/cccp.c | 2 - gnu/usr.bin/cc/lib/Makefile | 5 +- gnu/usr.bin/cc/libgcc/Makefile | 17 +- gnu/usr.bin/cc/libgcc/libgcc2.c | 5 + gnu/usr.bin/cc25/Freebsd.gcc258.patch | 39 + gnu/usr.bin/cc25/Makefile | 6 + gnu/usr.bin/cc25/README | 209 + gnu/usr.bin/cc25/gcc258-freebsd.patch | 1188 +++ gnu/usr.bin/cc25/gnu2bsd.tcl | 470 + gnu/usr.bin/cc25/usr.bin.cpp/Makefile | 10 + gnu/usr.bin/cc25/usr.bin.cpp/cpp.script | 91 + gnu/usr.bin/cc25/usr.bin.f77/Makefile | 7 + gnu/usr.bin/cc25/usr.bin.f77/f77.script | 114 + gnu/usr.bin/cvs/cvs/Makefile | 11 + gnu/usr.bin/cvs/cvs/checkin.c | 7 + gnu/usr.bin/cvs/cvs/checkout.c | 16 +- gnu/usr.bin/cvs/cvs/cvs.h | 6 +- gnu/usr.bin/cvs/cvs/diff.c | 26 +- gnu/usr.bin/cvs/cvs/ignore.c | 2 +- gnu/usr.bin/cvs/cvs/import.c | 6 +- gnu/usr.bin/cvs/cvs/main.c | 16 + gnu/usr.bin/cvs/cvs/patch.c | 24 +- gnu/usr.bin/cvs/cvs/release.c | 4 + gnu/usr.bin/cvs/cvs/update.c | 27 +- gnu/usr.bin/gdb/COPYING | 328 +- gnu/usr.bin/gdb/COPYING.LIB | 481 + gnu/usr.bin/gdb/Makefile | 39 +- gnu/usr.bin/gdb/README.FreeBSD | 15 + gnu/usr.bin/gdb/VERSION | 1 + gnu/usr.bin/gdb/bfd/COPYING | 339 + gnu/usr.bin/gdb/bfd/Makefile | 17 + gnu/usr.bin/gdb/bfd/README.FreeBSD | 7 + gnu/usr.bin/gdb/bfd/VERSION | 1 + gnu/usr.bin/gdb/bfd/aout-target.h | 429 + gnu/usr.bin/gdb/bfd/aout32.c | 23 + gnu/usr.bin/gdb/bfd/aoutx.h | 2568 +++++ gnu/usr.bin/gdb/bfd/archive.c | 1770 ++++ gnu/usr.bin/gdb/bfd/archures.c | 731 ++ gnu/usr.bin/gdb/bfd/bfd.c | 733 ++ gnu/usr.bin/gdb/bfd/bfd.h | 1803 ++++ gnu/usr.bin/gdb/bfd/cache.c | 311 + gnu/usr.bin/gdb/bfd/coffgen.c | 1519 +++ gnu/usr.bin/gdb/bfd/core.c | 106 + gnu/usr.bin/gdb/bfd/cpu-i386.c | 43 + gnu/usr.bin/gdb/bfd/ctor.c | 148 + gnu/usr.bin/gdb/bfd/ecoff.c | 3994 ++++++++ gnu/usr.bin/gdb/bfd/elf.c | 248 + gnu/usr.bin/gdb/bfd/format.c | 258 + gnu/usr.bin/gdb/bfd/freebsd386.c | 110 + gnu/usr.bin/gdb/bfd/init.c | 78 + gnu/usr.bin/gdb/bfd/libaout.h | 393 + gnu/usr.bin/gdb/bfd/libbfd.c | 850 ++ gnu/usr.bin/gdb/bfd/libbfd.h | 273 + gnu/usr.bin/gdb/bfd/libcoff.h | 352 + gnu/usr.bin/gdb/bfd/libecoff.h | 265 + gnu/usr.bin/gdb/bfd/libelf.h | 249 + gnu/usr.bin/gdb/bfd/opncls.c | 534 + gnu/usr.bin/gdb/bfd/reloc.c | 1225 +++ gnu/usr.bin/gdb/bfd/seclet.c | 185 + gnu/usr.bin/gdb/bfd/seclet.h | 55 + gnu/usr.bin/gdb/bfd/section.c | 899 ++ gnu/usr.bin/gdb/bfd/srec.c | 1001 ++ gnu/usr.bin/gdb/bfd/stab-syms.c | 59 + gnu/usr.bin/gdb/bfd/syms.c | 527 + gnu/usr.bin/gdb/bfd/sysdep.h | 47 + gnu/usr.bin/gdb/bfd/targets.c | 635 ++ gnu/usr.bin/gdb/bfd/trad-core.c | 384 + gnu/usr.bin/gdb/doc/ChangeLog | 783 ++ gnu/usr.bin/gdb/doc/Makefile | 340 + gnu/usr.bin/gdb/doc/Makefile.in | 327 + gnu/usr.bin/gdb/doc/a4rc.sed | 11 + gnu/usr.bin/gdb/doc/all-cfg.texi | 117 + gnu/usr.bin/gdb/doc/config.status | 5 + gnu/usr.bin/gdb/doc/configure.in | 7 + gnu/usr.bin/gdb/doc/gdb-cfg.texi | 117 + gnu/usr.bin/gdb/doc/gdb.info | 213 + gnu/usr.bin/gdb/doc/gdb.info-1 | 1304 +++ gnu/usr.bin/gdb/doc/gdb.info-2 | 1165 +++ gnu/usr.bin/gdb/doc/gdb.info-3 | 1264 +++ gnu/usr.bin/gdb/doc/gdb.info-4 | 1349 +++ gnu/usr.bin/gdb/doc/gdb.info-5 | 1215 +++ gnu/usr.bin/gdb/doc/gdb.info-6 | 1220 +++ gnu/usr.bin/gdb/doc/gdb.info-7 | 1233 +++ gnu/usr.bin/gdb/doc/gdb.info-8 | 657 ++ gnu/usr.bin/gdb/doc/gdb.texinfo | 8591 +++++++++++++++++ gnu/usr.bin/gdb/doc/gdbint.texinfo | 2658 +++++ gnu/usr.bin/gdb/doc/h8-cfg.texi | 47 + gnu/usr.bin/gdb/doc/libgdb.texinfo | 1471 +++ gnu/usr.bin/gdb/doc/lpsrc.sed | 13 + gnu/usr.bin/gdb/doc/psrc.sed | 13 + gnu/usr.bin/gdb/doc/refcard.ps | 798 ++ gnu/usr.bin/gdb/doc/refcard.tex | 646 ++ gnu/usr.bin/gdb/doc/remote.texi | 1294 +++ gnu/usr.bin/gdb/doc/stabs.texinfo | 3795 ++++++++ gnu/usr.bin/gdb/gdb.1 | 3 - gnu/usr.bin/gdb/gdb/COPYING | 339 + gnu/usr.bin/gdb/gdb/Makefile | 72 + gnu/usr.bin/gdb/gdb/ansidecl.h | 139 + gnu/usr.bin/gdb/gdb/aout/aout64.h | 431 + gnu/usr.bin/gdb/gdb/aout/ar.h | 32 + gnu/usr.bin/gdb/gdb/aout/ranlib.h | 62 + gnu/usr.bin/gdb/gdb/aout/stab.def | 264 + gnu/usr.bin/gdb/gdb/aout/stab_gnu.h | 36 + gnu/usr.bin/gdb/gdb/blockframe.c | 821 ++ gnu/usr.bin/gdb/gdb/breakpoint.c | 3301 +++++++ gnu/usr.bin/gdb/gdb/breakpoint.h | 372 + gnu/usr.bin/gdb/gdb/buildsym.c | 950 ++ gnu/usr.bin/gdb/gdb/buildsym.h | 259 + gnu/usr.bin/gdb/gdb/c-exp.y | 1601 +++ gnu/usr.bin/gdb/gdb/c-lang.c | 447 + gnu/usr.bin/gdb/gdb/c-lang.h | 31 + gnu/usr.bin/gdb/gdb/c-typeprint.c | 797 ++ gnu/usr.bin/gdb/gdb/c-valprint.c | 416 + gnu/usr.bin/gdb/gdb/call-cmds.h | 28 + gnu/usr.bin/gdb/gdb/ch-exp.y | 1997 ++++ gnu/usr.bin/gdb/gdb/ch-lang.c | 341 + gnu/usr.bin/gdb/gdb/ch-lang.h | 31 + gnu/usr.bin/gdb/gdb/ch-typeprint.c | 225 + gnu/usr.bin/gdb/gdb/ch-valprint.c | 332 + gnu/usr.bin/gdb/gdb/coff/ecoff.h | 262 + gnu/usr.bin/gdb/gdb/coff/internal.h | 538 ++ gnu/usr.bin/gdb/gdb/coff/sym.h | 477 + gnu/usr.bin/gdb/gdb/coff/symconst.h | 175 + gnu/usr.bin/gdb/gdb/coffread.c | 2071 ++++ gnu/usr.bin/gdb/gdb/command.c | 1310 +++ gnu/usr.bin/gdb/gdb/command.h | 241 + gnu/usr.bin/gdb/gdb/complaints.c | 158 + gnu/usr.bin/gdb/gdb/complaints.h | 46 + gnu/usr.bin/gdb/gdb/copying.c | 327 + gnu/usr.bin/gdb/gdb/core.c | 291 + gnu/usr.bin/gdb/gdb/coredep.c | 118 + gnu/usr.bin/gdb/gdb/corelow.c | 328 + gnu/usr.bin/gdb/gdb/cp-valprint.c | 484 + gnu/usr.bin/gdb/gdb/dbxread.c | 2234 +++++ gnu/usr.bin/gdb/gdb/dcache.c | 236 + gnu/usr.bin/gdb/gdb/dcache.h | 83 + gnu/usr.bin/gdb/gdb/defs.h | 901 ++ gnu/usr.bin/gdb/gdb/demangle.c | 190 + gnu/usr.bin/gdb/gdb/demangle.h | 77 + gnu/usr.bin/gdb/gdb/dis-asm.h | 176 + gnu/usr.bin/gdb/gdb/dis-buf.c | 69 + gnu/usr.bin/gdb/gdb/dwarfread.c | 3866 ++++++++ gnu/usr.bin/gdb/gdb/elf/common.h | 216 + gnu/usr.bin/gdb/gdb/elf/dwarf.h | 314 + gnu/usr.bin/gdb/gdb/elf/external.h | 190 + gnu/usr.bin/gdb/gdb/elf/internal.h | 195 + gnu/usr.bin/gdb/gdb/elfread.c | 729 ++ gnu/usr.bin/gdb/gdb/environ.c | 198 + gnu/usr.bin/gdb/gdb/environ.h | 58 + gnu/usr.bin/gdb/gdb/eval.c | 1213 +++ gnu/usr.bin/gdb/gdb/exec.c | 489 + gnu/usr.bin/gdb/gdb/expprint.c | 623 ++ gnu/usr.bin/gdb/gdb/expression.h | 313 + gnu/usr.bin/gdb/gdb/findvar.c | 971 ++ gnu/usr.bin/gdb/gdb/fopen-same.h | 27 + gnu/usr.bin/gdb/gdb/fork-child.c | 310 + gnu/usr.bin/gdb/gdb/frame.h | 238 + gnu/usr.bin/gdb/gdb/freebsd-nat.c | 323 + gnu/usr.bin/gdb/gdb/freebsd-solib.c | 1469 +++ gnu/usr.bin/gdb/gdb/gdb-stabs.h | 76 + gnu/usr.bin/gdb/gdb/gdb.1 | 371 + gnu/usr.bin/gdb/gdb/gdbcmd.h | 101 + gnu/usr.bin/gdb/gdb/gdbcore.h | 129 + gnu/usr.bin/gdb/gdb/gdbtypes.c | 1440 +++ gnu/usr.bin/gdb/gdb/gdbtypes.h | 704 ++ gnu/usr.bin/gdb/gdb/getopt.h | 129 + gnu/usr.bin/gdb/gdb/i386-dis.c | 1952 ++++ gnu/usr.bin/gdb/gdb/i386-pinsn.c | 37 + gnu/usr.bin/gdb/gdb/i386-tdep.c | 595 ++ gnu/usr.bin/gdb/gdb/infcmd.c | 1423 +++ gnu/usr.bin/gdb/gdb/inferior.h | 401 + gnu/usr.bin/gdb/gdb/inflow.c | 662 ++ gnu/usr.bin/gdb/gdb/infptrace.c | 436 + gnu/usr.bin/gdb/gdb/infrun.c | 1848 ++++ gnu/usr.bin/gdb/gdb/inftarg.c | 310 + gnu/usr.bin/gdb/gdb/init.c | 47 + gnu/usr.bin/gdb/gdb/language.c | 1332 +++ gnu/usr.bin/gdb/gdb/language.h | 413 + gnu/usr.bin/gdb/gdb/m2-exp.y | 1169 +++ gnu/usr.bin/gdb/gdb/m2-lang.c | 457 + gnu/usr.bin/gdb/gdb/m2-lang.h | 31 + gnu/usr.bin/gdb/gdb/m2-typeprint.c | 49 + gnu/usr.bin/gdb/gdb/m2-valprint.c | 45 + gnu/usr.bin/gdb/gdb/main.c | 2799 ++++++ gnu/usr.bin/gdb/gdb/maint.c | 305 + gnu/usr.bin/gdb/gdb/mem-break.c | 104 + gnu/usr.bin/gdb/gdb/minsyms.c | 597 ++ gnu/usr.bin/gdb/gdb/mipsread.c | 3653 +++++++ gnu/usr.bin/gdb/gdb/nlmread.c | 300 + gnu/usr.bin/gdb/gdb/nm.h | 44 + gnu/usr.bin/gdb/gdb/objfiles.c | 773 ++ gnu/usr.bin/gdb/gdb/objfiles.h | 437 + gnu/usr.bin/gdb/gdb/obstack.h | 490 + gnu/usr.bin/gdb/gdb/parse.c | 827 ++ gnu/usr.bin/gdb/gdb/parser-defs.h | 188 + gnu/usr.bin/gdb/gdb/partial-stab.h | 618 ++ gnu/usr.bin/gdb/gdb/printcmd.c | 2078 ++++ gnu/usr.bin/gdb/gdb/putenv.c | 111 + gnu/usr.bin/gdb/gdb/regex.c | 1725 ++++ gnu/usr.bin/gdb/gdb/regex.h | 179 + gnu/usr.bin/gdb/gdb/remote-utils.c | 645 ++ gnu/usr.bin/gdb/gdb/remote-utils.h | 149 + gnu/usr.bin/gdb/gdb/remote.c | 1272 +++ gnu/usr.bin/gdb/gdb/ser-unix.c | 633 ++ gnu/usr.bin/gdb/gdb/serial.c | 261 + gnu/usr.bin/gdb/gdb/serial.h | 153 + gnu/usr.bin/gdb/gdb/signals.h | 27 + gnu/usr.bin/gdb/gdb/solib.h | 56 + gnu/usr.bin/gdb/gdb/source.c | 1398 +++ gnu/usr.bin/gdb/gdb/stabsread.c | 3770 ++++++++ gnu/usr.bin/gdb/gdb/stabsread.h | 194 + gnu/usr.bin/gdb/gdb/stack.c | 1379 +++ gnu/usr.bin/gdb/gdb/symfile.c | 1489 +++ gnu/usr.bin/gdb/gdb/symfile.h | 228 + gnu/usr.bin/gdb/gdb/symmisc.c | 857 ++ gnu/usr.bin/gdb/gdb/symtab.c | 3035 ++++++ gnu/usr.bin/gdb/gdb/symtab.h | 1124 +++ gnu/usr.bin/gdb/gdb/target.c | 789 ++ gnu/usr.bin/gdb/gdb/target.h | 465 + gnu/usr.bin/gdb/gdb/terminal.h | 62 + gnu/usr.bin/gdb/gdb/thread.c | 248 + gnu/usr.bin/gdb/gdb/thread.h | 36 + gnu/usr.bin/gdb/gdb/tm-i386v.h | 309 + gnu/usr.bin/gdb/gdb/tm.h | 76 + gnu/usr.bin/gdb/gdb/typeprint.c | 297 + gnu/usr.bin/gdb/gdb/typeprint.h | 21 + gnu/usr.bin/gdb/gdb/utils.c | 1547 +++ gnu/usr.bin/gdb/gdb/valarith.c | 969 ++ gnu/usr.bin/gdb/gdb/valops.c | 1819 ++++ gnu/usr.bin/gdb/gdb/valprint.c | 1063 ++ gnu/usr.bin/gdb/gdb/valprint.h | 40 + gnu/usr.bin/gdb/gdb/value.h | 502 + gnu/usr.bin/gdb/gdb/values.c | 1502 +++ gnu/usr.bin/gdb/gdb/version.c | 3 + gnu/usr.bin/gdb/gdb/wait.h | 38 + gnu/usr.bin/gdb/gdb/xm.h | 31 + gnu/usr.bin/gdb/libiberty/COPYING.LIB | 481 + gnu/usr.bin/gdb/libiberty/Makefile | 13 + gnu/usr.bin/gdb/libiberty/README.FreeBSD | 7 + gnu/usr.bin/gdb/libiberty/alloca-conf.h | 11 + gnu/usr.bin/gdb/libiberty/argv.c | 332 + gnu/usr.bin/gdb/libiberty/basename.c | 56 + gnu/usr.bin/gdb/libiberty/concat.c | 118 + gnu/usr.bin/gdb/libiberty/config.h | 1 + gnu/usr.bin/gdb/libiberty/cplus-dem.c | 2669 +++++ gnu/usr.bin/gdb/libiberty/fdmatch.c | 71 + gnu/usr.bin/gdb/libiberty/getopt.c | 750 ++ gnu/usr.bin/gdb/libiberty/getopt1.c | 180 + gnu/usr.bin/gdb/libiberty/ieee-float.c | 150 + gnu/usr.bin/gdb/libiberty/ieee-float.h | 65 + gnu/usr.bin/gdb/libiberty/obstack.c | 460 + gnu/usr.bin/gdb/libiberty/sigsetmask.c | 44 + gnu/usr.bin/gdb/libiberty/spaces.c | 67 + gnu/usr.bin/gdb/libiberty/strerror.c | 811 ++ gnu/usr.bin/gdb/libiberty/strsignal.c | 634 ++ gnu/usr.bin/gdb/libiberty/xmalloc.c | 58 + gnu/usr.bin/gdb/mmalloc/Makefile | 10 + gnu/usr.bin/gdb/mmalloc/README.FreeBSD | 7 + gnu/usr.bin/gdb/mmalloc/attach.c | 218 + gnu/usr.bin/gdb/mmalloc/detach.c | 71 + gnu/usr.bin/gdb/mmalloc/keys.c | 66 + gnu/usr.bin/gdb/mmalloc/mcalloc.c | 53 + gnu/usr.bin/gdb/mmalloc/mfree.c | 247 + gnu/usr.bin/gdb/mmalloc/mmalloc.c | 334 + gnu/usr.bin/gdb/mmalloc/mmalloc.h | 390 + gnu/usr.bin/gdb/mmalloc/mmalloc.texi | 258 + gnu/usr.bin/gdb/mmalloc/mmap-sup.c | 144 + gnu/usr.bin/gdb/mmalloc/mmcheck.c | 196 + gnu/usr.bin/gdb/mmalloc/mmemalign.c | 64 + gnu/usr.bin/gdb/mmalloc/mmstats.c | 46 + gnu/usr.bin/gdb/mmalloc/mmtrace.c | 166 + gnu/usr.bin/gdb/mmalloc/mrealloc.c | 160 + gnu/usr.bin/gdb/mmalloc/mvalloc.c | 40 + gnu/usr.bin/gdb/mmalloc/sbrk-sup.c | 96 + gnu/usr.bin/gdb/readline/ChangeLog | 98 - gnu/usr.bin/gdb/readline/Makefile.gnu | 114 - gnu/usr.bin/gdb/readline/chardefs.h | 50 - gnu/usr.bin/gdb/readline/emacs_keymap.c | 472 - gnu/usr.bin/gdb/readline/history.c | 1462 --- gnu/usr.bin/gdb/readline/keymaps.h | 53 - gnu/usr.bin/gdb/readline/readline.c | 5557 ----------- gnu/usr.bin/gdb/readline/readline.h | 161 - gnu/usr.bin/gdb/readline/vi_keymap.c | 484 - gnu/usr.bin/gdb/readline/vi_mode.c | 875 -- gnu/usr.bin/groff/Makefile.cfg | 5 +- gnu/usr.bin/groff/addftinfo/Makefile | 1 + gnu/usr.bin/groff/devices/devascii/R.proto | 19 + gnu/usr.bin/groff/eqn/Makefile | 1 + gnu/usr.bin/groff/grodvi/Makefile | 1 + gnu/usr.bin/groff/groff/Makefile | 1 + gnu/usr.bin/groff/grops/Makefile | 1 + gnu/usr.bin/groff/grops/psrm.cc | 3 +- gnu/usr.bin/groff/grotty/Makefile | 1 + gnu/usr.bin/groff/indxbib/Makefile | 1 + gnu/usr.bin/groff/libbib/Makefile | 1 + gnu/usr.bin/groff/libdriver/Makefile | 1 + gnu/usr.bin/groff/libgroff/Makefile | 1 + gnu/usr.bin/groff/lkbib/Makefile | 1 + gnu/usr.bin/groff/lookbib/Makefile | 1 + gnu/usr.bin/groff/pic/Makefile | 1 + gnu/usr.bin/groff/refer/Makefile | 1 + gnu/usr.bin/groff/soelim/Makefile | 1 + gnu/usr.bin/groff/tbl/Makefile | 1 + gnu/usr.bin/groff/tfmtodit/Makefile | 1 + gnu/usr.bin/groff/troff/Makefile | 1 + gnu/usr.bin/groff/xditview/device.c | 6 + gnu/usr.bin/gzip/Makefile | 1 + gnu/usr.bin/kgdb/COPYING | 249 + gnu/usr.bin/{gdb => kgdb}/ChangeLog | 0 gnu/usr.bin/{gdb => kgdb}/Gdbinit | 0 gnu/usr.bin/kgdb/Makefile | 36 + gnu/usr.bin/{gdb => kgdb}/Makefile.dist | 0 gnu/usr.bin/{gdb => kgdb}/Projects | 0 gnu/usr.bin/{gdb => kgdb}/README.gnu | 0 gnu/usr.bin/{gdb => kgdb}/XGdbinit.samp | 0 gnu/usr.bin/{gdb => kgdb}/Xgdb.ad | 0 gnu/usr.bin/{gdb => kgdb}/blockframe.c | 0 gnu/usr.bin/{gdb => kgdb}/breakpoint.c | 0 gnu/usr.bin/{gdb => kgdb}/command.c | 0 gnu/usr.bin/{gdb => kgdb}/command.h | 0 .../{gdb => kgdb}/config/Makefile.i386 | 0 .../{gdb => kgdb}/config/default-dep.c | 0 gnu/usr.bin/{gdb => kgdb}/config/i386-dep.c | 0 gnu/usr.bin/{gdb => kgdb}/config/i386-pinsn.c | 0 .../{gdb => kgdb}/config/i386bsd-dep.c | 3 + .../{gdb => kgdb}/config/m-i386-sv32.h | 0 gnu/usr.bin/{gdb => kgdb}/config/m-i386.h | 0 gnu/usr.bin/{gdb => kgdb}/config/m-i386bsd.h | 0 .../{gdb => kgdb}/config/m-i386g-sv32.h | 0 gnu/usr.bin/{gdb => kgdb}/config/m-i386gas.h | 0 gnu/usr.bin/{gdb => kgdb}/copying.c | 0 gnu/usr.bin/{gdb => kgdb}/core.c | 0 gnu/usr.bin/{gdb => kgdb}/cplus-dem.c | 0 gnu/usr.bin/{gdb => kgdb}/dbxread.c | 0 gnu/usr.bin/{gdb => kgdb}/defs.h | 0 gnu/usr.bin/{gdb => kgdb}/environ.c | 0 gnu/usr.bin/{gdb => kgdb}/environ.h | 0 gnu/usr.bin/{gdb => kgdb}/eval.c | 0 gnu/usr.bin/{gdb => kgdb}/expprint.c | 0 gnu/usr.bin/{gdb => kgdb}/expread.y | 0 gnu/usr.bin/{gdb => kgdb}/expression.h | 0 gnu/usr.bin/{gdb => kgdb}/findvar.c | 0 gnu/usr.bin/{gdb => kgdb}/frame.h | 0 gnu/usr.bin/{gdb => kgdb}/getpagesize.h | 0 gnu/usr.bin/{gdb => kgdb}/infcmd.c | 0 gnu/usr.bin/{gdb => kgdb}/inferior.h | 0 gnu/usr.bin/{gdb => kgdb}/inflow.c | 0 gnu/usr.bin/{gdb => kgdb}/infrun.c | 0 gnu/usr.bin/kgdb/kgdb.1 | 15 + gnu/usr.bin/{gdb => kgdb}/kgdb_proto.h | 2 +- gnu/usr.bin/{gdb => kgdb}/main.c | 7 +- gnu/usr.bin/{gdb => kgdb}/ngdb.i386/Makefile | 0 gnu/usr.bin/{gdb => kgdb}/obstack.c | 0 gnu/usr.bin/{gdb => kgdb}/obstack.h | 0 gnu/usr.bin/{gdb => kgdb}/printcmd.c | 0 gnu/usr.bin/{gdb => kgdb}/regex.c | 0 gnu/usr.bin/{gdb => kgdb}/regex.h | 0 gnu/usr.bin/{gdb => kgdb}/remote-sl.c | 0 gnu/usr.bin/{gdb => kgdb}/remote.c | 2 +- gnu/usr.bin/{gdb => kgdb}/source.c | 0 gnu/usr.bin/{gdb => kgdb}/stab.def | 0 gnu/usr.bin/{gdb => kgdb}/stack.c | 0 gnu/usr.bin/{gdb => kgdb}/symmisc.c | 0 gnu/usr.bin/{gdb => kgdb}/symseg.h | 0 gnu/usr.bin/{gdb => kgdb}/symtab.c | 2 +- gnu/usr.bin/{gdb => kgdb}/symtab.h | 0 gnu/usr.bin/{gdb => kgdb}/utils.c | 2 +- gnu/usr.bin/{gdb => kgdb}/valarith.c | 0 gnu/usr.bin/{gdb => kgdb}/valops.c | 0 gnu/usr.bin/{gdb => kgdb}/valprint.c | 0 gnu/usr.bin/{gdb => kgdb}/value.h | 0 gnu/usr.bin/{gdb => kgdb}/values.c | 0 gnu/usr.bin/{gdb => kgdb}/version.c | 0 gnu/usr.bin/{gdb => kgdb}/wait.h | 0 gnu/usr.bin/{gdb => kgdb}/xgdb/Makefile | 0 gnu/usr.bin/{gdb => kgdb}/xgdb/xgdb.c | 2 +- gnu/usr.bin/ld/etc.c | 153 +- gnu/usr.bin/ld/i386/md.c | 20 +- gnu/usr.bin/ld/i386/md.h | 4 +- gnu/usr.bin/ld/i386/mdprologue.S | 4 +- gnu/usr.bin/ld/ld.1 | 7 +- gnu/usr.bin/ld/ld.c | 766 +- gnu/usr.bin/ld/ld.h | 35 +- gnu/usr.bin/ld/ldconfig/Makefile | 4 +- gnu/usr.bin/ld/ldconfig/ldconfig.8 | 2 + gnu/usr.bin/ld/ldconfig/ldconfig.c | 21 +- gnu/usr.bin/ld/ldd/ldd.1 | 1 - gnu/usr.bin/ld/ldd/ldd.c | 56 +- gnu/usr.bin/ld/lib.c | 234 +- gnu/usr.bin/ld/rrs.c | 75 +- gnu/usr.bin/ld/rtld/Makefile | 4 +- gnu/usr.bin/ld/rtld/malloc.c | 5 +- gnu/usr.bin/ld/rtld/rtld.c | 124 +- gnu/usr.bin/ld/shlib.c | 39 +- gnu/usr.bin/ld/sparc/md.c | 12 +- gnu/usr.bin/ld/symbol.c | 44 +- gnu/usr.bin/ld/warnings.c | 217 +- gnu/usr.bin/man/Makefile.inc | 2 + gnu/usr.bin/man/apropos/Makefile | 24 +- gnu/usr.bin/man/catman/Makefile | 17 +- gnu/usr.bin/man/catman/{catman => catman.sh} | 15 +- gnu/usr.bin/man/lib/Makefile | 5 +- gnu/usr.bin/man/lib/config.h_dist | 16 +- gnu/usr.bin/man/makewhatis/Makefile | 4 +- gnu/usr.bin/man/makewhatis/makewhatis.sh | 9 +- gnu/usr.bin/man/man/Makefile | 3 +- gnu/usr.bin/man/man/man.c | 75 +- gnu/usr.bin/man/man/man.man | 4 +- gnu/usr.bin/man/manpath/Makefile | 2 +- gnu/usr.bin/man/manpath/manpath.config | 4 +- gnu/usr.bin/man/whatis/Makefile | 23 +- gnu/usr.bin/patch/patch.1 | 6 +- gnu/usr.bin/patch/patch.c | 26 +- gnu/usr.bin/patch/pch.c | 6 +- .../.keep_me => gnu/usr.bin/ptx/.stamp-h.in | 0 gnu/usr.bin/ptx/COPYING | 339 + gnu/usr.bin/ptx/ChangeLog | 546 ++ gnu/usr.bin/ptx/Makefile | 10 + gnu/usr.bin/ptx/NEWS | 53 + gnu/usr.bin/ptx/README | 23 + gnu/usr.bin/ptx/THANKS | 23 + gnu/usr.bin/ptx/TODO | 94 + gnu/usr.bin/ptx/alloca.c | 484 + gnu/usr.bin/ptx/argmatch.c | 94 + gnu/usr.bin/ptx/bumpalloc.h | 58 + gnu/usr.bin/ptx/check-out | 65 + gnu/usr.bin/ptx/config.h | 57 + gnu/usr.bin/ptx/diacrit.c | 148 + gnu/usr.bin/ptx/diacrit.h | 16 + gnu/usr.bin/ptx/error.c | 117 + gnu/usr.bin/ptx/examples/README | 21 + gnu/usr.bin/ptx/examples/ajay/Makefile | 28 + gnu/usr.bin/ptx/examples/ajay/README | 41 + gnu/usr.bin/ptx/examples/ajay/footer.tex | 1 + gnu/usr.bin/ptx/examples/ajay/header.tex | 21 + gnu/usr.bin/ptx/examples/ajay/tip.forgptx | 10 + gnu/usr.bin/ptx/examples/ajay/x.pl | 22 + gnu/usr.bin/ptx/examples/ignore/README | 65 + gnu/usr.bin/ptx/examples/ignore/bix | 109 + gnu/usr.bin/ptx/examples/ignore/eign | 163 + gnu/usr.bin/ptx/examples/include.pl | 79 + gnu/usr.bin/ptx/examples/latex/Makefile | 15 + gnu/usr.bin/ptx/examples/latex/README | 10 + gnu/usr.bin/ptx/examples/latex/latex.tex | 11 + gnu/usr.bin/ptx/examples/latex/table.tex | 65 + gnu/usr.bin/ptx/examples/luke/README | 2 + gnu/usr.bin/ptx/examples/luke/xxroff.sh | 108 + gnu/usr.bin/ptx/getopt.c | 757 ++ gnu/usr.bin/ptx/getopt.h | 129 + gnu/usr.bin/ptx/getopt1.c | 187 + gnu/usr.bin/ptx/mkinstalldirs | 35 + gnu/usr.bin/ptx/ptx.c | 2237 +++++ gnu/usr.bin/ptx/ptx.info | 496 + gnu/usr.bin/ptx/ptx.texinfo | 554 ++ gnu/usr.bin/ptx/regex.h | 490 + gnu/usr.bin/ptx/texinfo.tex | 4053 ++++++++ gnu/usr.bin/ptx/xmalloc.c | 88 + gnu/usr.bin/rcs/co/co.1 | 10 +- gnu/usr.bin/rcs/co/co.c | 13 +- gnu/usr.bin/rcs/lib/Makefile | 2 +- gnu/usr.bin/rcs/lib/rcsbase.h | 10 +- gnu/usr.bin/rcs/lib/rcsedit.c | 13 +- gnu/usr.bin/rcs/lib/rcskeys.c | 61 +- gnu/usr.bin/rcs/rlog/rlog.1 | 6 +- gnu/usr.bin/rcs/rlog/rlog.c | 29 +- gnu/usr.bin/tar/Makefile | 1 + gnu/usr.bin/tar/extract.c | 36 + gnu/usr.bin/tar/tar.c | 3 + gnu/usr.bin/tar/tar.h | 1 + include/Makefile | 2 +- include/ar.h | 2 +- include/assert.h | 2 +- include/ctype.h | 144 +- include/grp.h | 2 +- include/kvm.h | 4 - include/nlist.h | 2 +- include/octype.h | 82 + include/protocols/dumprestore.h | 2 +- include/pwd.h | 2 +- include/rpcsvc/Makefile | 4 +- usr.bin/vi/include/ndbm.h => include/rune.h | 55 +- .../vi/include/glob.h => include/runetype.h | 111 +- include/setjmp.h | 2 +- include/skey.h | 36 + include/stddef.h | 12 +- include/stdio.h | 8 +- include/stdlib.h | 48 +- include/time.h | 2 +- include/utmp.h | 2 +- include/varargs.h | 2 +- lib/Makefile | 10 +- lib/Makefile.inc | 2 +- lib/csu.i386/Makefile | 13 +- lib/csu.i386/c++rt0.c | 80 + lib/csu.i386/crt0.c | 11 +- lib/csu.i386/crt1.c | 47 - lib/libc/Makefile | 2 + lib/libc/compat-43/Makefile.inc | 5 +- lib/libc/{gen => compat-43}/setrgid.c | 15 +- lib/libc/{gen => compat-43}/setruid.c | 15 +- lib/libc/db/hash/hash.c | 2 + lib/libc/db/recno/rec_open.c | 2 +- lib/libc/gen/Makefile.inc | 13 +- lib/libc/gen/ctype_.c | 8 +- lib/libc/gen/getcap.3 | 2 +- lib/libc/gen/getcap.c | 29 +- lib/libc/gen/getfsent.3 | 2 +- lib/libc/gen/getmntinfo.3 | 2 +- lib/libc/gen/getpwent.3 | 14 + lib/libc/gen/getpwent.c | 93 +- lib/libc/gen/semconfig.c | 2 +- lib/libc/gen/setmode.c | 11 +- lib/libc/i386/DEFS.h | 2 +- lib/libc/i386/string/bcmp.S | 11 +- lib/libc/i386/string/memcmp.S | 15 +- lib/libc/i386/string/memmove.S | 17 +- lib/libc/i386/string/memset.S | 16 +- lib/libc/i386/string/strcmp.S | 4 +- lib/libc/i386/string/strncmp.S | 69 +- lib/libc/locale/Makefile.inc | 18 +- lib/libc/locale/ansi.c | 148 + lib/libc/locale/euc.4 | 231 + lib/libc/locale/euc.c | 220 + .../vi/nex/ex_cd.c => lib/libc/locale/frune.c | 105 +- lib/libc/{gen => locale}/isctype.c | 86 +- lib/libc/locale/mbrune.3 | 157 + lib/libc/locale/mbrune.c | 112 + lib/libc/locale/multibyte.3 | 241 + .../nex/ex_util.c => lib/libc/locale/none.c | 89 +- lib/libc/locale/rune.3 | 269 + lib/libc/locale/rune.c | 334 + lib/libc/locale/setlocale.3 | 321 + lib/libc/locale/setlocale.c | 198 +- lib/libc/locale/table.c | 160 + lib/libc/locale/utf2.4 | 87 + lib/libc/locale/utf2.c | 148 + lib/libc/net/gethostnamadr.c | 1 + lib/libc/net/ns_addr.c | 4 +- lib/libc/net/rcmd.c | 30 +- lib/libc/stdio/Makefile.inc | 7 +- lib/libc/stdio/fclose.c | 2 +- lib/libc/stdio/fgetline.c | 1 + lib/libc/stdio/{fgetline.3 => fgetln.3} | 52 +- lib/libc/stdio/fgetln.c | 162 + lib/libc/stdio/fseek.c | 2 +- lib/libc/stdio/gets.c | 13 +- lib/libc/stdio/local.h | 2 +- lib/libc/stdio/printf.3 | 2 +- lib/libc/stdlib/Makefile.inc | 2 +- lib/libc/stdlib/rand.c | 2 +- lib/libc/string/index.3 | 2 +- lib/libc/string/strftime.c | 1 + lib/libc/sys/Makefile.inc | 9 +- lib/libc/sys/execve.2 | 2 +- lib/libc/sys/setregid.2 | 2 +- lib/libc/sys/setreuid.2 | 2 +- lib/libc/{gen/setuid.3 => sys/setuid.2} | 64 +- lib/libc/sys/sigsuspend.2 | 4 +- lib/libcompat/Makefile | 18 + lib/libcompat/cftime.c | 63 + lib/libcompat/ftime.c | 69 + lib/libcompat/libcompat.3 | 205 + lib/libcompat/regex.c | 93 + lib/libcompat/regexp/COPYRIGHT | 22 + lib/libcompat/regexp/Makefile.inc | 20 + lib/libcompat/regexp/README | 84 + lib/libcompat/regexp/regerror.c | 18 + lib/libcompat/regexp/regexp.3 | 321 + lib/libcompat/regexp/regexp.c | 1320 +++ lib/libcompat/regexp/regexp.h | 21 + lib/libcompat/regexp/regmagic.h | 5 + lib/libcompat/regexp/regsub.c | 81 + lib/libcompat/setrgid.c | 49 + lib/libcompat/setruid.c | 49 + lib/libcompat/sgtty.c | 67 + lib/libcurses/Makefile | 3 +- lib/libcurses/cr_put.c | 24 +- lib/libcurses/curses.h | 1 + lib/libcurses/refresh.c | 42 +- lib/libcurses/setterm.c | 27 + lib/libcurses/tstp.c | 8 +- lib/libcurses/tty.c | 41 +- lib/libmalloc/CHANGES | 58 + lib/libmalloc/COPYRIGHT | 23 + lib/libmalloc/Makefile | 17 + lib/libmalloc/Makefile.moraes | 187 + lib/libmalloc/NOTE | 151 + lib/libmalloc/README | 68 + lib/libmalloc/TODO | 62 + lib/libmalloc/_emalloc.c | 55 + lib/libmalloc/_malloc.c | 88 + lib/libmalloc/_memalign.c | 37 + lib/libmalloc/_strdup.c | 23 + lib/libmalloc/_strsave.c | 23 + lib/libmalloc/align.h | 94 + lib/libmalloc/assert.h | 10 + lib/libmalloc/botch.c | 45 + lib/libmalloc/bsd.lib.mk | 269 + lib/libmalloc/defs.h | 386 + lib/libmalloc/dumpheap.c | 107 + lib/libmalloc/emalloc.c | 69 + lib/libmalloc/externs.h | 113 + lib/libmalloc/getmem.c | 108 + lib/libmalloc/globals.c | 87 + lib/libmalloc/globals.h | 43 + lib/libmalloc/globrename.h | 46 + lib/libmalloc/leak.c | 160 + lib/libmalloc/malloc.c | 622 ++ lib/libmalloc/malloc.doc | 653 ++ lib/libmalloc/malloc.h | 136 + lib/libmalloc/memalign.c | 160 + lib/libmalloc/setopts.c | 120 + lib/libmalloc/sptree.c | 763 ++ lib/libmalloc/sptree.h | 65 + lib/libmalloc/stats.c | 38 + lib/libmalloc/strdup.c | 26 + lib/libmalloc/strsave.c | 21 + lib/libmalloc/tests/munge.sh | 40 + lib/libmalloc/tests/plot.sh | 81 + lib/libmalloc/tests/regress | 11 + lib/libmalloc/tests/simumalloc.c | 239 + lib/libmalloc/tests/t1.c | 40 + lib/libmalloc/tests/t2.c | 37 + lib/libmalloc/tests/t3.c | 110 + lib/libmalloc/tests/t4.c | 20 + lib/libmalloc/tests/t5.c | 31 + lib/libmalloc/tests/test.out | 415 + lib/libmalloc/tests/testmalloc.c | 182 + lib/libmalloc/tests/testmemalign.c | 16 + lib/libmalloc/tests/testrun.sh | 28 + lib/libmalloc/tests/testsbrk.c | 22 + lib/libmalloc/tests/teststomp.c | 34 + lib/libmalloc/trace.h | 19 + lib/libmalloc/verify.c | 81 + lib/libmalloc/version.c | 1 + lib/libpthread/include/stdio.h | 4 +- lib/libpthread/stdio/fflush.c | 4 +- lib/libpthread/stdio/ftell.c | 4 +- lib/libpthread/stdio/vfprintf.c | 6 +- lib/libskey/Makefile | 7 + lib/libskey/authfile.c | 177 + lib/libskey/md4.c | 336 + lib/libskey/md4.h | 47 + lib/libskey/pathnames.h | 5 + lib/libskey/put.c | 2289 +++++ lib/libskey/skey_crypt.c | 37 + lib/libskey/skeylogin.c | 328 + lib/libskey/skeysubr.c | 225 + lib/libterm/Makefile | 4 +- lib/libterm/tputs.c | 14 +- lib/libutil/kvm.c | 33 +- lib/libutil/login.c | 37 +- lib/msun/Makefile | 111 + .../pathnames.h => lib/msun/i387/DEFS.h | 51 +- lib/msun/i387/e_acos.S | 49 + lib/msun/i387/e_asin.S | 48 + lib/msun/i387/e_atan2.S | 43 + lib/msun/i387/e_exp.S | 52 + lib/msun/i387/e_fmod.S | 47 + lib/msun/i387/e_log.S | 43 + lib/msun/i387/e_log10.S | 43 + lib/msun/i387/e_remainder.S | 47 + lib/msun/i387/e_scalb.S | 43 + lib/msun/i387/e_sqrt.S | 42 + lib/msun/i387/s_atan.S | 43 + lib/msun/i387/s_ceil.S | 57 + lib/msun/i387/s_copysign.S | 47 + lib/msun/i387/s_cos.S | 55 + lib/msun/i387/s_finite.S | 45 + lib/msun/i387/s_floor.S | 57 + lib/msun/i387/s_ilogb.S | 52 + lib/msun/i387/s_log1p.S | 43 + lib/msun/i387/s_logb.S | 43 + lib/msun/i387/s_rint.S | 42 + lib/msun/i387/s_scalbn.S | 43 + lib/msun/i387/s_significand.S | 43 + lib/msun/i387/s_sin.S | 55 + lib/msun/i387/s_tan.S | 56 + .../flcopy/flcopy.8 => lib/msun/man/acos.3 | 110 +- lib/msun/man/acosh.3 | 82 + lib/msun/man/asin.3 | 91 + lib/msun/man/asinh.3 | 70 + lib/msun/man/atan.3 | 75 + lib/msun/man/atan2.3 | 189 + lib/msun/man/atanh.3 | 84 + lib/msun/man/ceil.3 | 63 + lib/msun/man/cos.3 | 74 + lib/msun/man/cosh.3 | 75 + lib/msun/man/erf.3 | 83 + lib/msun/man/exp.3 | 287 + lib/msun/man/fabs.3 | 67 + lib/msun/man/floor.3 | 63 + lib/msun/man/fmod.3 | 76 + lib/msun/man/hypot.3 | 125 + lib/msun/man/ieee.3 | 152 + lib/msun/man/ieee_test.3 | 90 + lib/msun/man/j0.3 | 128 + lib/msun/man/lgamma.3 | 124 + lib/msun/man/math.3 | 633 ++ lib/msun/man/rint.3 | 63 + lib/msun/man/sin.3 | 73 + lib/msun/man/sinh.3 | 75 + lib/msun/man/sqrt.3 | 121 + lib/msun/man/tan.3 | 74 + lib/msun/man/tanh.3 | 71 + lib/msun/src/Readme | 211 + lib/msun/src/dependencies | 471 + lib/msun/src/e_acos.c | 116 + lib/msun/src/e_acosh.c | 75 + lib/msun/src/e_asin.c | 125 + lib/msun/src/e_atan2.c | 132 + lib/msun/src/e_atanh.c | 78 + lib/msun/src/e_cosh.c | 92 + lib/msun/src/e_exp.c | 167 + lib/msun/src/e_fmod.c | 153 + lib/msun/src/e_gamma.c | 35 + lib/msun/src/e_gamma_r.c | 34 + lib/msun/src/e_hypot.c | 125 + lib/msun/src/e_j0.c | 488 + lib/msun/src/e_j1.c | 486 + lib/msun/src/e_jn.c | 282 + lib/msun/src/e_lgamma.c | 35 + lib/msun/src/e_lgamma_r.c | 313 + lib/msun/src/e_log.c | 149 + lib/msun/src/e_log10.c | 101 + lib/msun/src/e_pow.c | 308 + lib/msun/src/e_rem_pio2.c | 153 + lib/msun/src/e_remainder.c | 89 + lib/msun/src/e_scalb.c | 54 + lib/msun/src/e_sinh.c | 85 + lib/msun/src/e_sqrt.c | 461 + lib/msun/src/fdlibm.h | 196 + lib/msun/src/k_cos.c | 102 + lib/msun/src/k_rem_pio2.c | 319 + lib/msun/src/k_sin.c | 84 + lib/msun/src/k_standard.c | 737 ++ lib/msun/src/k_tan.c | 137 + lib/msun/src/math.h | 224 + lib/msun/src/s_asinh.c | 71 + lib/msun/src/s_atan.c | 143 + lib/msun/src/s_cbrt.c | 95 + lib/msun/src/s_ceil.c | 88 + lib/msun/src/s_copysign.c | 42 + lib/msun/src/s_cos.c | 87 + lib/msun/src/s_erf.c | 320 + lib/msun/src/s_expm1.c | 226 + lib/msun/src/s_fabs.c | 38 + lib/msun/src/s_finite.c | 41 + lib/msun/src/s_floor.c | 89 + lib/msun/src/s_frexp.c | 67 + lib/msun/src/s_ilogb.c | 56 + lib/msun/src/s_isnan.c | 50 + lib/msun/src/s_ldexp.c | 31 + lib/msun/src/s_lib_version.c | 38 + lib/msun/src/s_log1p.c | 175 + lib/msun/src/s_logb.c | 48 + lib/msun/src/s_matherr.c | 29 + lib/msun/src/s_modf.c | 92 + lib/msun/src/s_nextafter.c | 90 + lib/msun/src/s_rint.c | 94 + lib/msun/src/s_scalbn.c | 73 + lib/msun/src/s_signgam.c | 2 + lib/msun/src/s_significand.c | 33 + lib/msun/src/s_sin.c | 87 + lib/msun/src/s_tan.c | 81 + lib/msun/src/s_tanh.c | 85 + lib/msun/src/w_acos.c | 42 + lib/msun/src/w_acosh.c | 41 + lib/msun/src/w_asin.c | 43 + lib/msun/src/w_atan2.c | 42 + lib/msun/src/w_atanh.c | 46 + lib/msun/src/w_cabs.c | 27 + lib/msun/src/w_cosh.c | 41 + lib/msun/src/w_drem.c | 15 + lib/msun/src/w_exp.c | 52 + lib/msun/src/w_fmod.c | 42 + lib/msun/src/w_gamma.c | 48 + lib/msun/src/w_gamma_r.c | 45 + lib/msun/src/w_hypot.c | 42 + lib/msun/src/w_j0.c | 68 + lib/msun/src/w_j1.c | 69 + lib/msun/src/w_jn.c | 91 + lib/msun/src/w_lgamma.c | 48 + lib/msun/src/w_lgamma_r.c | 45 + lib/msun/src/w_log.c | 42 + lib/msun/src/w_log10.c | 45 + lib/msun/src/w_pow.c | 62 + lib/msun/src/w_remainder.c | 41 + lib/msun/src/w_scalb.c | 59 + lib/msun/src/w_sinh.c | 41 + lib/msun/src/w_sqrt.c | 41 + libexec/Makefile | 4 +- libexec/bootpd/bootpd.8 | 2 +- libexec/bootpd/bootptab.5 | 2 +- libexec/ftpd/Makefile | 9 +- libexec/ftpd/ftpd.c | 20 + libexec/ftpd/skey-stuff.c | 23 + libexec/getty/gettytab.h | 4 +- libexec/getty/main.c | 12 +- libexec/pppd/Makefile | 26 +- libexec/pppd/README | 284 + libexec/pppd/args.h | 1 + libexec/pppd/auth.c | 828 ++ libexec/pppd/callout.h | 2 + libexec/pppd/chap.c | 962 +- libexec/pppd/chap.h | 93 +- libexec/pppd/fsm.c | 1054 +- libexec/pppd/fsm.h | 76 +- libexec/pppd/ipcp.c | 1057 +- libexec/pppd/ipcp.h | 32 +- libexec/pppd/lcp.c | 1193 ++- libexec/pppd/lcp.h | 37 +- libexec/pppd/magic.c | 4 + libexec/pppd/magic.h | 2 + libexec/pppd/main.c | 2765 ++---- libexec/pppd/md5.c | 134 +- libexec/pppd/options.c | 1195 +++ libexec/pppd/patchlevel.h | 7 +- libexec/pppd/pathnames.h | 16 +- {sys/net => libexec/pppd}/ppp.h | 6 +- libexec/pppd/pppd.8 | 2 +- libexec/pppd/pppd.h | 347 +- libexec/pppd/sys-bsd.c | 503 + libexec/pppd/sys-str.c | 643 ++ libexec/pppd/upap.c | 338 +- libexec/pppd/upap.h | 41 +- libexec/rexecd/Makefile | 6 + libexec/rexecd/rexecd.c | 11 + libexec/rlogind/Makefile | 15 +- libexec/rlogind/rlogind.c | 7 +- libexec/rpc.rusersd/rusers_proc.c | 2 +- libexec/rshd/Makefile | 16 +- libexec/telnetd/sys_term.c | 9 +- libexec/uucpd/Makefile | 1 + libexec/uucpd/pathnames.h | 2 +- libexec/uucpd/uucpd.c | 218 +- libexec/xtend/Makefile | 11 + libexec/xtend/packet.c | 317 + libexec/xtend/paths.h | 11 + libexec/xtend/status.c | 109 + libexec/xtend/user.c | 162 + libexec/xtend/xten.h | 58 + libexec/xtend/xtend.8 | 174 + libexec/xtend/xtend.c | 319 + libexec/xtend/xtend.h | 77 + sbin/Makefile | 10 +- sbin/chkconfig/chkconfig.c | 30 +- sbin/comcontrol/comcontrol.8 | 79 +- sbin/comcontrol/comcontrol.c | 24 +- sbin/disklabel/disklabel.c | 113 +- sbin/dump/dump.8 | 2 +- sbin/dump/dumpoptr.c | 3 +- sbin/dump/dumptape.c | 17 +- sbin/dump/rdump.8 | 2 +- sbin/fsck/fsck.8 | 2 +- sbin/fsck/pass5.c | 15 +- sbin/fsck/setup.c | 4 +- sbin/fsck/utilities.c | 6 +- sbin/ft/Makefile | 3 +- sbin/ft/ft.8 | 6 +- sbin/ft/ft.c | 219 +- sbin/ft/ftecc.c | 446 +- sbin/ifconfig/ifconfig.c | 6 +- sbin/init.chmr/configure.c | 26 +- sbin/init/init.o | Bin 0 -> 5660 bytes sbin/md5/Makefile | 34 + sbin/md5/README | 34 + sbin/md5/global.h | 30 + sbin/md5/md5-announcement.txt | 37 + sbin/md5/md5.1 | 43 + sbin/md5/md5.h | 36 + sbin/md5/md5c.c | 333 + sbin/md5/mddriver.c | 231 + sbin/mount/mount.8 | 4 + sbin/mount/mount.c | 18 +- sbin/mountd/mountd.c | 2 +- sbin/ping/ping.c | 66 +- sbin/restore/Makefile | 2 +- sbin/restore/dirs.c | 2 +- sbin/restore/pathnames.h | 2 +- sbin/restore/restore.h | 2 +- sbin/restore/rrestore.8 | 2 +- sbin/restore/tape.c | 2 +- sbin/route/route.c | 4 +- sbin/slattach/slattach.c | 11 +- share/Makefile | 4 +- share/doc/ps1/06.sysman/a.t | 4 +- share/doc/smm/05.fsck/3.t | 2 +- share/doc/smm/05.fsck/Makefile | 2 +- share/doc/usd/04.csh/Makefile | 1 + share/doc/usd/04.csh/csh.a | 2 +- share/doc/usd/34.trek/trek.me | 17 +- share/locale/Ja_JP.EUC | 158 + share/locale/Makefile | 23 + share/locale/POSIX | 33 + share/locale/Russian.koi8-r | 39 + .../vi/nvi/v_exmode.c => share/locale/ldef.h | 43 +- share/locale/lex.l | 152 + share/locale/mklocale.1 | 257 + share/locale/yacc.y | 821 ++ share/man/man4/ddb.4 | 3 +- share/man/man4/man4.i386/Makefile | 4 +- share/man/man4/man4.i386/lpa.4 | 62 - share/man/man4/man4.i386/lpt.4 | 6 + share/man/man4/man4.i386/sio.4 | 289 +- share/man/man4/man4.i386/tw.4 | 111 + share/man/man5/Makefile | 6 +- share/man/man5/pcfs.5 | 294 +- share/man/man5/skey.access.5 | 34 + share/man/man7/mdoc.7 | 409 + share/man/man8/adduser.8 | 16 +- share/me/footnote.me | 2 +- share/me/me.7 | 90 +- share/me/tmac.e | 4 +- share/mk/bsd.dep.mk | 2 +- share/mk/bsd.doc.mk | 5 +- share/mk/bsd.lib.mk | 26 +- share/mk/bsd.man.mk | 53 +- share/mk/bsd.own.mk | 2 +- share/mk/bsd.prog.mk | 52 +- share/mk/sys.mk | 8 +- share/syscons/examples/setrus | 18 +- share/syscons/fonts/Makefile | 15 +- share/syscons/fonts/alt-8x14.fnt | 83 + share/syscons/fonts/alt-8x16.fnt | 95 + share/syscons/fonts/alt-8x8.fnt | 49 + .../syscons/fonts/{alt8x16.fnt => altb-8x16} | Bin share/syscons/fonts/altb-8x16.fnt | 95 + share/syscons/fonts/altc-8x16.fnt | 95 + share/syscons/fonts/cp850-8x14.fnt | 83 + share/syscons/fonts/cp850-8x16.fnt | 95 + share/syscons/fonts/cp850-8x8.fnt | 49 + share/syscons/fonts/cp865-8x14.fnt | 83 + share/syscons/fonts/cp865-8x16.fnt | 95 + share/syscons/fonts/cp865-8x8.fnt | 49 + share/syscons/fonts/iso-8x14.fnt | 83 + share/syscons/fonts/iso-8x16.fnt | 95 + share/syscons/fonts/iso-8x8.fnt | 49 + share/syscons/fonts/koi8-8x14.fnt | 83 + share/syscons/fonts/koi8-8x16.fnt | 95 + share/syscons/fonts/koi8-8x8.fnt | 49 + share/syscons/fonts/koi8b-8x16 | Bin 0 -> 4096 bytes share/syscons/fonts/koi8b-8x16.fnt | 95 + share/syscons/fonts/koi8c-8x16.fnt | 95 + share/syscons/keymaps/Makefile | 24 +- share/syscons/keymaps/danish.cp865.kbd | 109 + share/syscons/keymaps/danish.iso.kbd | 109 + share/syscons/keymaps/german.cp850.kbd | 109 + share/syscons/keymaps/german.iso.kbd | 109 + share/syscons/keymaps/ru.koi8-r | 4 +- share/syscons/keymaps/ru.koi8-r.kbd | 237 + share/syscons/keymaps/swedish.cp850.kbd | 109 + share/syscons/keymaps/swedish.iso | 64 +- share/syscons/keymaps/swedish.iso.kbd | 109 + share/syscons/keymaps/uk.cp850.kbd | 109 + share/syscons/keymaps/uk.iso.kbd | 109 + share/syscons/keymaps/us.iso.kbd | 109 + share/syscons/scrnmaps/Makefile | 16 +- share/syscons/scrnmaps/koi8-r2alt.scm | 9 + share/tmac/Makefile | 7 +- share/tmac/doc-syms | 14 +- share/zoneinfo/Makefile | 2 +- sys/conf/files | 5 +- sys/conf/newvers.sh | 12 +- sys/conf/param.c | 2 +- sys/{i386 => }/doc/Changes | 94 +- sys/{i386 => }/doc/Makefile | 2 +- sys/{i386 => }/doc/ata/ata-1 | 0 sys/{i386 => }/doc/ata/ata-10 | 0 sys/{i386 => }/doc/ata/ata-11 | 0 sys/{i386 => }/doc/ata/ata-2 | 0 sys/{i386 => }/doc/ata/ata-3 | 0 sys/{i386 => }/doc/ata/ata-4 | 0 sys/{i386 => }/doc/ata/ata-5 | 0 sys/{i386 => }/doc/ata/ata-6 | 0 sys/{i386 => }/doc/ata/ata-7 | 0 sys/{i386 => }/doc/ata/ata-8 | 0 sys/{i386 => }/doc/ata/ata-9 | 0 sys/{i386 => }/doc/ata/ata-apx | 0 sys/{i386 => }/doc/ata/ata-prt | 0 sys/{i386 => }/doc/ata/ata-toc | 0 sys/{i386 => }/doc/ed.relnotes | 2 +- sys/doc/memory-test.doc | 40 + sys/doc/options.doc | 682 ++ sys/{i386 => }/doc/options.texi | 256 +- sys/doc/seagate.doc | 125 + sys/doc/sound.doc | 80 + sys/{i386 => }/doc/vm_layout.doc | 2 +- sys/{i386 => }/doc/wt.doc | 0 sys/gnu/fpemul/Changelog | 36 + sys/gnu/fpemul/README | 277 + sys/gnu/fpemul/control_w.h | 95 + sys/gnu/fpemul/div_small.s | 101 + sys/gnu/fpemul/errors.c | 612 ++ sys/gnu/fpemul/exception.h | 102 + sys/gnu/fpemul/fpu_arith.c | 235 + sys/gnu/fpemul/fpu_asm.h | 82 + sys/gnu/fpemul/fpu_aux.c | 233 + sys/gnu/fpemul/fpu_emu.h | 188 + sys/gnu/fpemul/fpu_entry.c | 483 + sys/gnu/fpemul/fpu_etc.c | 175 + sys/gnu/fpemul/fpu_proto.h | 115 + sys/gnu/fpemul/fpu_system.h | 97 + sys/gnu/fpemul/fpu_trig.c | 1367 +++ sys/gnu/fpemul/get_address.c | 203 + sys/gnu/fpemul/load_store.c | 269 + sys/gnu/fpemul/math_emu.h | 47 + sys/gnu/fpemul/poly_2xm1.c | 141 + sys/gnu/fpemul/poly_atan.c | 252 + sys/gnu/fpemul/poly_div.s | 144 + sys/gnu/fpemul/poly_l2.c | 318 + sys/gnu/fpemul/poly_mul64.s | 124 + sys/gnu/fpemul/poly_sin.c | 192 + sys/gnu/fpemul/poly_tan.c | 229 + sys/gnu/fpemul/polynomial.s | 192 + sys/gnu/fpemul/reg_add_sub.c | 303 + sys/gnu/fpemul/reg_compare.c | 384 + sys/gnu/fpemul/reg_constant.c | 175 + sys/gnu/fpemul/reg_constant.h | 82 + sys/gnu/fpemul/reg_div.s | 295 + sys/gnu/fpemul/reg_ld_str.c | 1387 +++ sys/gnu/fpemul/reg_mul.c | 162 + sys/gnu/fpemul/reg_norm.s | 182 + sys/gnu/fpemul/reg_round.s | 653 ++ sys/gnu/fpemul/reg_u_add.s | 244 + sys/gnu/fpemul/reg_u_div.s | 506 + sys/gnu/fpemul/reg_u_mul.s | 199 + sys/gnu/fpemul/reg_u_sub.s | 361 + sys/gnu/fpemul/status_w.h | 106 + sys/gnu/fpemul/version.h | 61 + sys/gnu/fpemul/wm_shrx.s | 261 + sys/gnu/fpemul/wm_sqrt.s | 496 + sys/i386/boot/Makefile | 45 +- sys/i386/boot/biosboot | Bin 0 -> 512 bytes sys/i386/boot/boot | Bin 0 -> 7632 bytes sys/i386/boot/boot.c | 12 +- sys/i386/boot/boot.sym | Bin 0 -> 10379 bytes sys/i386/boot/boot2.S | 12 +- sys/i386/boot/bootbios | Bin 0 -> 7120 bytes sys/i386/boot/disk.c | 45 +- sys/i386/boot/io.c | 20 +- sys/i386/boot/start.S | 3 +- sys/i386/conf/ECLIPSE | 66 + sys/i386/conf/GENERICAH | 13 +- sys/i386/conf/GENERICBT | 12 +- sys/i386/conf/HAMSTER | 67 + sys/i386/conf/LAPTOP | 68 + sys/i386/conf/LINT | 81 +- sys/i386/conf/Makefile.i386 | 18 +- sys/i386/conf/SYSCONS | 86 - sys/i386/conf/TIME | 64 + sys/i386/conf/WCARCH | 67 + sys/i386/conf/WCARCHIVE | 73 + sys/i386/conf/devices.i386 | 3 +- sys/i386/conf/files.i386 | 94 +- sys/i386/doc/sound.doc | 38 - sys/i386/i386/autoconf.c | 7 +- sys/i386/i386/conf.c | 65 +- sys/i386/i386/db_interface.c | 21 +- sys/i386/i386/exception.s | 140 +- sys/i386/i386/in_cksum.c | 94 +- sys/i386/i386/locore.s | 117 +- sys/i386/i386/machdep.c | 133 +- sys/i386/i386/math_emulate.c | 144 +- sys/i386/i386/microtime.s | 87 +- sys/i386/i386/pmap.c | 917 +- sys/i386/i386/random.s | 60 + sys/i386/i386/support.s | 323 +- sys/i386/i386/swtch.s | 43 +- sys/i386/i386/trap.c | 872 +- sys/i386/i386/vm_machdep.c | 889 +- sys/i386/include/ansi.h | 21 +- sys/i386/include/asmacros.h | 6 + sys/i386/include/console.h | 31 +- sys/i386/include/cpu.h | 13 +- sys/i386/include/cpufunc.h | 13 +- sys/i386/include/ioctl_fd.h | 31 +- sys/i386/include/limits.h | 6 +- sys/i386/include/lpt.h | 24 + sys/i386/include/mouse.h | 44 + sys/i386/include/npx.h | 10 +- sys/i386/include/param.h | 6 +- sys/i386/include/pcaudioio.h | 75 + sys/i386/include/pmap.h | 55 +- sys/i386/include/psl.h | 6 +- sys/i386/include/pte.h | 4 +- sys/i386/include/soundcard.h | 50 +- sys/i386/include/spl.h | 104 + sys/i386/include/ultrasound.h | 9 +- sys/i386/include/vmparam.h | 2 +- sys/i386/isa/aha1542.c | 13 +- sys/i386/isa/bt742a.c | 113 +- sys/i386/isa/bt742a_32.c | 1694 ++++ sys/i386/isa/clock.c | 279 +- sys/i386/isa/com.c | 101 +- sys/i386/isa/debug.h | 85 - sys/i386/isa/elink.c | 77 + sys/i386/isa/elink.h | 39 + sys/i386/isa/fd.c | 776 +- sys/i386/isa/fdc.h | 12 +- sys/i386/isa/fdreg.h | 20 +- sys/i386/isa/ft.c | 1182 ++- sys/i386/isa/ftreg.h | 11 +- sys/i386/isa/ic/i82365.h | 190 + sys/i386/isa/ic/nec765.h | 73 +- sys/i386/isa/icu.h | 12 +- sys/i386/isa/icu.s | 494 +- sys/i386/isa/if_ed.c | 1441 +-- sys/i386/isa/if_edreg.h | 2 +- sys/i386/isa/if_el.c | 800 ++ sys/i386/isa/if_elreg.h | 76 + sys/i386/isa/if_ep.c | 164 +- sys/i386/isa/if_ie507.h | 19 + sys/i386/isa/if_is.c | 10 +- sys/i386/isa/if_ze.c | 1951 ++++ sys/i386/isa/if_zereg.h | 859 ++ sys/i386/isa/ipl.h | 7 + sys/i386/isa/isa.c | 227 +- sys/i386/isa/isa.h | 9 +- sys/i386/isa/isa_device.h | 4 +- sys/i386/isa/kbdtables.h | 40 +- sys/i386/isa/lpa.c | 14 +- sys/i386/isa/lpt.c | 150 +- sys/i386/isa/mcd.c | 5 +- sys/i386/isa/npx.c | 22 +- sys/i386/isa/pcaudio.c | 430 + sys/i386/isa/pccons.c | 101 +- sys/i386/isa/psm.c | 464 + sys/i386/isa/seagate.c | 2036 ++++ sys/i386/isa/sio.c | 1242 +-- sys/i386/isa/sound/CHANGELOG | 75 + sys/i386/isa/sound/RELNOTES.Linux | 248 +- sys/i386/isa/sound/adlib_card.c | 13 +- sys/i386/isa/sound/audio.c | 106 +- sys/i386/isa/sound/debug.h | 29 - sys/i386/isa/sound/dev_table.c | 148 +- sys/i386/isa/sound/dev_table.h | 46 +- sys/i386/isa/sound/dmabuf.c | 364 +- sys/i386/isa/sound/dsp.c | 270 - sys/i386/isa/sound/gus_card.c | 87 +- sys/i386/isa/sound/gus_hw.h | 15 + sys/i386/isa/sound/gus_linearvol.h | 18 + sys/i386/isa/sound/gus_midi.c | 14 +- sys/i386/isa/sound/gus_vol.c | 70 +- sys/i386/isa/sound/gus_wave.c | 1812 +++- sys/i386/isa/sound/ics2101.c | 265 + sys/i386/isa/sound/local.h | 13 +- sys/i386/isa/sound/midi.c | 216 +- sys/i386/isa/sound/midibuf.c | 14 +- sys/i386/isa/sound/mpu401.c | 129 +- sys/i386/isa/sound/opl3.c | 68 +- sys/i386/isa/sound/os.h | 94 +- sys/i386/isa/sound/pas.h | 12 +- sys/i386/isa/sound/pas2_card.c | 135 +- sys/i386/isa/sound/pas2_midi.c | 16 +- sys/i386/isa/sound/pas2_mixer.c | 40 +- sys/i386/isa/sound/pas2_pcm.c | 91 +- sys/i386/isa/sound/patmgr.c | 41 +- sys/i386/isa/sound/pro_midi.c | 140 +- sys/i386/isa/sound/sb.h | 28 + sys/i386/isa/sound/sb16_dsp.c | 627 ++ sys/i386/isa/sound/sb16_midi.c | 287 + sys/i386/isa/sound/sb_card.c | 13 +- sys/i386/isa/sound/sb_dsp.c | 1148 +-- sys/i386/isa/sound/sb_midi.c | 224 + sys/i386/isa/sound/sb_mixer.c | 422 + sys/i386/isa/sound/sb_mixer.h | 212 + sys/i386/isa/sound/sequencer.c | 319 +- sys/i386/isa/sound/sound_calls.h | 59 +- sys/i386/isa/sound/sound_config.h | 43 +- sys/i386/isa/sound/sound_switch.c | 445 + sys/i386/isa/sound/soundcard.c | 307 +- sys/i386/isa/spkr.c | 23 +- sys/i386/isa/syscons.c | 623 +- sys/i386/isa/tw.c | 997 ++ sys/i386/isa/ultra14f.c | 6 +- sys/i386/isa/vector.s | 196 +- sys/i386/isa/wd.c | 204 +- sys/i386/isa/wt.c | 3 +- sys/i386/isa/wt.c.orig | 902 ++ sys/i386/netboot/Makefile | 9 +- sys/i386/netboot/bootmenu.c | 2 +- sys/i386/netboot/ether.c | 479 + sys/i386/netboot/ether.h | 178 + sys/i386/netboot/wd80x3.c | 240 - sys/i386/pci/ncr.c | 5507 +++++++++++ sys/i386/pci/ncr_reg.h | 489 + sys/i386/pci/pci.c | 494 + sys/i386/pci/pci.h | 58 + sys/i386/pci/pci_config.c | 45 + sys/i386/pci/pci_device.h | 88 + sys/i386/pci/pcibios.c | 261 + sys/i386/pci/pcibios.h | 53 + sys/isofs/isofs_rrip.c | 7 +- sys/isofs/isofs_vfsops.c | 6 +- sys/isofs/isofs_vnops.c | 15 +- sys/kern/imgact_aout.c | 6 +- sys/kern/init_main.c | 34 +- sys/kern/init_sysent.c | 8 +- sys/kern/kern_acct.c | 2 +- sys/kern/kern_clock.c | 608 +- sys/kern/kern_descrip.c | 4 +- sys/kern/kern_execve.c | 45 +- sys/kern/kern_exit.c | 5 +- sys/kern/kern_fork.c | 10 +- sys/kern/kern_malloc.c | 74 +- sys/kern/kern_ntptime.c | 267 + sys/kern/kern_physio.c | 105 +- sys/kern/kern_prot.c | 2 +- sys/kern/kern_resource.c | 2 +- sys/kern/kern_sig.c | 12 +- sys/kern/kern_subr.c | 2 +- sys/kern/kern_synch.c | 4 +- sys/kern/kern_time.c | 6 +- sys/kern/makesyscalls.sh | 4 +- sys/kern/spec_vnops.c | 4 +- sys/kern/subr_prf.c | 11 +- sys/kern/subr_rand.c | 100 + sys/kern/sys_process.c | 2 +- sys/kern/syscalls.c | 6 +- sys/kern/syscalls.master | 6 +- sys/kern/sysv_msg.c | 6 +- sys/kern/sysv_sem.c | 12 +- sys/kern/sysv_shm.c | 14 +- sys/kern/tty.c | 545 +- sys/kern/tty_conf.c | 6 +- sys/kern/tty_pty.c | 155 +- sys/kern/uipc_mbuf.c | 17 +- sys/kern/vfs__bio.c | 95 +- sys/kern/vfs_lookup.c | 15 +- sys/kern/vfs_subr.c | 25 +- sys/kern/vfs_syscalls.c | 7 +- sys/kern/vfs_vnops.c | 3 +- sys/net/if.c | 7 +- sys/net/if.h | 12 +- sys/net/if_ethersubr.c | 226 +- sys/net/if_loop.c | 30 +- sys/net/if_ppp.c | 108 +- sys/net/if_sl.c | 54 +- sys/net/netisr.h | 15 +- sys/net/pppdefs.h | 41 + sys/net/raw_cb.h | 3 +- sys/net/route.c | 2 +- sys/netinet/if_ether.c | 8 +- sys/netinet/if_ether.h | 100 +- sys/netinet/igmp.c | 321 + .../stdlib/multibyte.c => sys/netinet/igmp.h | 89 +- sys/netinet/igmp_var.h | 80 + sys/netinet/in.c | 132 +- sys/netinet/in.h | 37 +- sys/netinet/in_pcb.c | 93 +- sys/netinet/in_pcb.h | 7 +- sys/netinet/in_pcb.old.c | 503 + sys/netinet/in_pcb.orig.c | 498 + sys/netinet/in_proto.c | 12 +- sys/netinet/in_var.h | 117 +- sys/netinet/ip_icmp.c | 7 +- sys/netinet/ip_input.c | 53 +- sys/netinet/ip_mroute.c | 1056 ++ sys/netinet/ip_mroute.h | 174 + sys/netinet/ip_output.c | 494 +- sys/netinet/ip_var.h | 17 +- sys/netinet/raw_ip.c | 54 +- sys/netinet/tcp_usrreq.c | 7 +- sys/netinet/udp_usrreq.c | 104 +- sys/nfs/nfs_bio.c | 8 +- sys/nfs/nfs_serv.c | 16 +- sys/nfs/nfs_socket.c | 2 +- sys/nfs/nfs_subs.c | 60 +- sys/nfs/nfs_vnops.c | 16 +- sys/pcfs/pcfs_conv.c | 6 +- sys/pcfs/pcfs_fat.c | 18 +- sys/pcfs/pcfs_vfsops.c | 5 +- sys/pcfs/pcfs_vnops.c | 41 +- sys/procfs/procfs_subr.c | 174 +- sys/procfs/procfs_vnops.c | 10 +- sys/scsi/cd.c | 13 +- sys/scsi/scsi_base.c | 16 +- sys/scsi/scsi_ioctl.c | 2 +- sys/scsi/scsiconf.h | 3 +- sys/scsi/sd.c | 20 +- sys/scsi/st.c | 22 +- sys/sys/acct.h | 2 +- sys/sys/buf.h | 8 +- sys/sys/callout.h | 2 +- sys/sys/conf.h | 4 +- sys/sys/disklabel.h | 3 +- sys/sys/dkstat.h | 2 +- sys/sys/errno.h | 2 +- sys/sys/exec.h | 4 +- sys/sys/fcntl.h | 2 +- sys/sys/ftape.h | 5 + sys/sys/ioctl.h | 9 +- sys/sys/ioctl_compat.h | 2 +- sys/sys/ipc.h | 2 +- sys/sys/kernel.h | 11 +- sys/sys/malloc.h | 17 +- sys/sys/map.h | 2 +- sys/sys/mbuf.h | 54 +- sys/sys/mount.h | 5 +- sys/sys/namei.h | 2 +- sys/sys/param.h | 2 +- sys/sys/proc.h | 2 +- sys/sys/procfs.h | 24 +- sys/sys/signal.h | 2 +- sys/sys/specdev.h | 4 +- sys/sys/stat.h | 2 +- sys/sys/syscall.h | 6 +- sys/sys/systm.h | 42 +- sys/sys/termios.h | 8 +- sys/sys/timeb.h | 2 +- sys/sys/times.h | 2 +- sys/sys/timex.h | 290 + sys/sys/tty.h | 55 +- sys/sys/ttydefaults.h | 8 +- sys/sys/types.h | 2 +- sys/sys/unistd.h | 12 +- sys/ufs/dir.h | 2 +- sys/ufs/ufs_disksubr.c | 7 +- sys/ufs/ufs_lookup.c | 2 +- sys/ufs/ufs_vfsops.c | 2 +- sys/ufs/ufs_vnops.c | 7 +- sys/vm/device_pager.c | 1 + sys/vm/queue.h | 26 +- sys/vm/swap_pager.c | 1020 +- sys/vm/swap_pager.h | 9 +- sys/vm/vm_fault.c | 28 +- sys/vm/vm_glue.c | 52 +- sys/vm/vm_mmap.c | 103 +- sys/vm/vm_object.c | 24 +- sys/vm/vm_object.h | 5 +- sys/vm/vm_page.c | 95 +- sys/vm/vm_page.h | 40 +- sys/vm/vm_pageout.c | 795 +- sys/vm/vm_pageout.h | 3 + sys/vm/vm_pager.c | 22 +- sys/vm/vm_pager.h | 4 +- sys/vm/vm_swap.c | 4 +- sys/vm/vm_unix.c | 9 +- sys/vm/vnode_pager.c | 1478 ++- usr.bin/Makefile | 29 +- usr.bin/ar/replace.c | 4 +- usr.bin/basename/basename.1 | 2 +- usr.bin/cap_mkdb/Makefile | 5 + usr.bin/cap_mkdb/cap_mkdb.1 | 101 + usr.bin/cap_mkdb/cap_mkdb.c | 250 + usr.bin/chat/chat.c | 4 +- usr.bin/chpass/Makefile | 10 +- usr.bin/chpass/chpass.c | 37 +- usr.bin/chpass/pw_copy.c | 81 +- usr.bin/crontab/crontab.1 | 2 +- usr.bin/crontab/crontab.5 | 2 +- usr.bin/crontab/crontab.c | 2 +- usr.bin/elvis/input.c | 2 +- usr.bin/elvis/tmp.c | 1 + usr.bin/env/env.1 | 2 +- usr.bin/finger/sprint.c | 5 +- usr.bin/finger/util.c | 4 +- usr.bin/ftp/glob.c | 7 +- usr.bin/groups/groups.c | 25 +- usr.bin/ipcs/Makefile | 2 + usr.bin/join/join.c | 29 +- usr.bin/key/Makefile | 21 + usr.bin/key/README.WZV | 100 + usr.bin/key/key.1 | 49 + usr.bin/key/skey.1 | 59 + usr.bin/key/skey.c | 128 + usr.bin/keyinfo/Makefile | 9 + usr.bin/keyinfo/keyinfo.1 | 40 + usr.bin/keyinfo/keyinfo.sh | 10 + usr.bin/keyinit/Makefile | 20 + usr.bin/keyinit/keyinit.1 | 64 + usr.bin/keyinit/skeyinit.c | 194 + usr.bin/last/last.c | 4 +- usr.bin/lex/lib/Makefile | 2 +- usr.bin/login/Makefile | 22 +- usr.bin/login/README | 10 + usr.bin/login/klogin.c | 2 +- usr.bin/login/login.access.5 | 50 + usr.bin/login/login.c | 49 + usr.bin/login/login_access.c | 236 + usr.bin/login/login_skey.c | 105 + usr.bin/login/pathnames.h | 1 + usr.bin/mail/Makefile | 3 +- usr.bin/mail/mail.1 | 3 + usr.bin/make/str.c | 8 +- usr.bin/mesg/mesg.c | 2 +- usr.bin/more/output.c | 2 +- usr.bin/netstat/Makefile | 2 +- usr.bin/netstat/if.c | 92 +- usr.bin/netstat/inet.c | 44 +- usr.bin/netstat/main.c | 33 +- usr.bin/netstat/mroute.c | 211 + usr.bin/netstat/netstat.1 | 6 +- usr.bin/nice/nice.1 | 2 +- usr.bin/passwd/Makefile | 18 +- .../passwd/kpasswd_proto.h | 25 +- usr.bin/passwd/krb_passwd.c | 316 + usr.bin/passwd/local_passwd.c | 15 +- usr.bin/passwd/passwd.c | 4 +- usr.bin/passwd/pw_fastmkdb.c | 268 + usr.bin/passwd/yp_passwd.c | 7 +- usr.bin/ranlib/build.c | 8 +- usr.bin/rdist/defs.h | 2 +- usr.bin/rev/rev.c | 7 +- usr.bin/rlogin/Makefile | 17 +- usr.bin/rlogin/kcmd.c | 309 + usr.bin/rlogin/krcmd.c | 150 + usr.bin/rsh/Makefile | 18 +- usr.bin/rup/rup.c | 6 +- usr.bin/sed/Makefile | 6 +- usr.bin/sed/POSIX | 11 +- usr.bin/sed/compile.c | 167 +- usr.bin/sed/defs.h | 11 +- usr.bin/sed/extern.h | 11 +- usr.bin/sed/main.c | 21 +- usr.bin/sed/misc.c | 7 +- usr.bin/sed/process.c | 154 +- usr.bin/split/split.c | 2 +- usr.bin/strings/strings.c | 2 +- usr.bin/su/Makefile | 21 +- usr.bin/su/su.1 | 4 - usr.bin/su/su.c | 75 +- usr.bin/syscons/Makefile | 4 - usr.bin/syscons/syscons.1 | 103 - usr.bin/syscons/syscons.c | 545 -- usr.bin/telnet/Makefile | 6 + usr.bin/telnet/commands.c | 2 +- usr.bin/telnet/telnet.1 | 37 +- usr.bin/telnet/telnet.c | 7 +- usr.bin/tn3270/tools/mkhits/dohits.c | 2 +- usr.bin/tput/tput.c | 6 +- usr.bin/tset/tset.c | 13 +- usr.bin/vi/Makefile | 80 +- usr.bin/vi/README | 152 +- usr.bin/vi/args.h | 4 +- usr.bin/vi/ascii.c | 93 +- usr.bin/vi/compat.h | 56 + usr.bin/vi/cut.c | 323 +- usr.bin/vi/cut.h | 6 +- usr.bin/vi/delete.c | 30 +- usr.bin/vi/docs/README | 177 + usr.bin/vi/docs/USD.doc/edit/Makefile | 18 + usr.bin/vi/docs/USD.doc/edit/edit.vindex | 115 + usr.bin/vi/docs/USD.doc/edit/edittut.ms | 2322 +++++ usr.bin/vi/docs/USD.doc/ex/Makefile | 14 + usr.bin/vi/docs/USD.doc/ex/ex.rm | 2230 +++++ usr.bin/vi/docs/USD.doc/ex/ex.summary | 734 ++ usr.bin/vi/docs/USD.doc/vi/Makefile | 17 + usr.bin/vi/docs/USD.doc/vi/vi.apwh.ms | 1079 +++ usr.bin/vi/docs/USD.doc/vi/vi.chars | 644 ++ usr.bin/vi/docs/USD.doc/vi/vi.in | 2064 ++++ usr.bin/vi/docs/USD.doc/vi/vi.summary | 468 + usr.bin/vi/docs/bugs.current | 48 + usr.bin/vi/docs/changelog | 138 + usr.bin/vi/docs/features | 47 + usr.bin/vi/docs/internals/autowrite | 88 + usr.bin/vi/docs/internals/gdb.script | 68 + usr.bin/vi/docs/internals/input | 314 + usr.bin/vi/docs/internals/quoting | 219 + usr.bin/vi/docs/internals/structures | 61 + usr.bin/vi/docs/set.opt.roff | 1065 ++ usr.bin/vi/docs/spell.ok | 163 + usr.bin/vi/docs/tutorial/vi.advanced | 1458 +++ usr.bin/vi/docs/tutorial/vi.beginner | 741 ++ usr.bin/vi/docs/tutorial/vi.tut.csh | 24 + usr.bin/vi/{ => docs}/vi.1 | 1 + usr.bin/vi/docs/vi.ref | 523 + usr.bin/vi/docs/vi.ref.txt | 634 ++ usr.bin/vi/{nex => ex}/ex.c | 223 +- usr.bin/vi/{nex => ex}/ex_abbrev.c | 16 +- usr.bin/vi/{nex => ex}/ex_append.c | 27 +- usr.bin/vi/{nex => ex}/ex_args.c | 22 +- usr.bin/vi/{nex => ex}/ex_argv.c | 68 +- usr.bin/vi/{nex => ex}/ex_at.c | 16 +- usr.bin/vi/{nex => ex}/ex_bang.c | 15 +- usr.bin/vi/ex/ex_cd.c | 205 + usr.bin/vi/{nex => ex}/ex_delete.c | 15 +- usr.bin/vi/{nex => ex}/ex_digraph.c | 14 +- usr.bin/vi/{nex => ex}/ex_display.c | 14 +- usr.bin/vi/{nex => ex}/ex_edit.c | 14 +- usr.bin/vi/{nex => ex}/ex_equal.c | 15 +- usr.bin/vi/{nex => ex}/ex_exit.c | 15 +- usr.bin/vi/{nex => ex}/ex_file.c | 14 +- usr.bin/vi/{nex => ex}/ex_global.c | 50 +- usr.bin/vi/{nex => ex}/ex_init.c | 28 +- usr.bin/vi/{nex => ex}/ex_join.c | 26 +- usr.bin/vi/{nex => ex}/ex_map.c | 16 +- usr.bin/vi/{nex => ex}/ex_mark.c | 15 +- usr.bin/vi/{nex => ex}/ex_mkexrc.c | 16 +- usr.bin/vi/ex/ex_move.c | 208 + usr.bin/vi/{nex => ex}/ex_open.c | 15 +- usr.bin/vi/{nex => ex}/ex_preserve.c | 14 +- usr.bin/vi/{nex => ex}/ex_print.c | 16 +- usr.bin/vi/{nex => ex}/ex_put.c | 14 +- usr.bin/vi/{nex => ex}/ex_read.c | 50 +- usr.bin/vi/{nex => ex}/ex_screen.c | 32 +- usr.bin/vi/{nex => ex}/ex_script.c | 18 +- usr.bin/vi/{nex => ex}/ex_set.c | 15 +- usr.bin/vi/{nex => ex}/ex_shell.c | 34 +- usr.bin/vi/{nex => ex}/ex_shift.c | 16 +- usr.bin/vi/{nex => ex}/ex_source.c | 15 +- usr.bin/vi/{nex => ex}/ex_stop.c | 14 +- usr.bin/vi/{nex => ex}/ex_subst.c | 94 +- usr.bin/vi/{nex => ex}/ex_tag.c | 283 +- usr.bin/vi/{nex => ex}/ex_undo.c | 15 +- usr.bin/vi/{nex => ex}/ex_usage.c | 30 +- usr.bin/vi/ex/ex_util.c | 180 + usr.bin/vi/{nex => ex}/ex_version.c | 19 +- usr.bin/vi/{nex => ex}/ex_visual.c | 14 +- usr.bin/vi/{nex => ex}/ex_write.c | 53 +- usr.bin/vi/{nex => ex}/ex_yank.c | 15 +- usr.bin/vi/{nex => ex}/ex_z.c | 14 +- usr.bin/vi/{nex => ex}/excmd.c | 72 +- usr.bin/vi/{nex => ex}/excmd.h.stub | 280 +- usr.bin/vi/{nex => ex}/filter.c | 31 +- usr.bin/vi/{nex => ex}/script.h | 0 usr.bin/vi/{nex => ex}/tag.h | 0 usr.bin/vi/exf.c | 35 +- usr.bin/vi/exf.h | 7 +- usr.bin/vi/gs.h | 28 +- usr.bin/vi/include/bitstring.h | 143 - usr.bin/vi/include/cdefs.h | 98 - usr.bin/vi/include/compat.h | 241 - usr.bin/vi/include/err.h | 16 - usr.bin/vi/include/file.h | 15 - usr.bin/vi/include/mpool.h | 135 - usr.bin/vi/include/queue.h | 245 - usr.bin/vi/interrupt.h | 96 - usr.bin/vi/intr.c | 178 + usr.bin/vi/line.c | 27 +- usr.bin/vi/log.c | 61 +- usr.bin/vi/log.h | 6 +- usr.bin/vi/main.c | 196 +- usr.bin/vi/mark.c | 130 +- usr.bin/vi/mark.h | 37 +- usr.bin/vi/mem.h | 11 +- usr.bin/vi/msg.h | 26 +- usr.bin/vi/nex/ex_move.c | 133 - usr.bin/vi/nvi/v_section.c | 146 - usr.bin/vi/nvi/v_word.c | 560 -- usr.bin/vi/nvi/v_yank.c | 114 - usr.bin/vi/nvi/vcmd.h | 274 - usr.bin/vi/options.c | 140 +- usr.bin/vi/options.h.stub | 8 +- usr.bin/vi/options_f.c | 113 +- usr.bin/vi/pathnames.h | 4 +- usr.bin/vi/put.c | 248 + usr.bin/vi/recover.c | 116 +- usr.bin/vi/screen.c | 25 +- usr.bin/vi/screen.h | 155 +- usr.bin/vi/search.c | 112 +- usr.bin/vi/search.h | 5 +- usr.bin/vi/seq.c | 152 +- usr.bin/vi/seq.h | 7 +- usr.bin/vi/sex/sex_confirm.c | 15 +- usr.bin/vi/sex/sex_get.c | 96 +- usr.bin/vi/sex/sex_refresh.c | 15 +- usr.bin/vi/sex/sex_screen.c | 33 +- usr.bin/vi/sex/sex_term.c | 22 +- usr.bin/vi/sex/sex_util.c | 28 +- usr.bin/vi/svi/svi_confirm.c | 14 +- usr.bin/vi/svi/svi_ex.c | 22 +- usr.bin/vi/svi/svi_get.c | 28 +- usr.bin/vi/svi/svi_line.c | 41 +- usr.bin/vi/svi/svi_refresh.c | 140 +- usr.bin/vi/svi/svi_relative.c | 334 +- usr.bin/vi/svi/svi_screen.c | 93 +- usr.bin/vi/svi/svi_screen.h | 37 +- usr.bin/vi/svi/svi_smap.c | 140 +- usr.bin/vi/svi/svi_split.c | 57 +- usr.bin/vi/svi/svi_util.c | 175 +- usr.bin/vi/term.c | 426 +- usr.bin/vi/term.h | 129 +- usr.bin/vi/timer.c | 254 +- usr.bin/vi/trace.c | 15 +- usr.bin/vi/util.c | 98 +- usr.bin/vi/vi.h | 51 +- usr.bin/vi/{nvi => vi}/getc.c | 25 +- usr.bin/vi/{nvi => vi}/v_again.c | 21 +- usr.bin/vi/{nvi => vi}/v_at.c | 26 +- usr.bin/vi/{nvi => vi}/v_ch.c | 224 +- usr.bin/vi/{nvi => vi}/v_delete.c | 106 +- usr.bin/vi/{nvi => vi}/v_ex.c | 40 +- usr.bin/vi/{nvi => vi}/v_filter.c | 21 +- usr.bin/vi/{nvi => vi}/v_increment.c | 31 +- usr.bin/vi/{nvi => vi}/v_init.c | 19 +- usr.bin/vi/{nvi => vi}/v_join.c | 25 +- usr.bin/vi/vi/v_left.c | 286 + usr.bin/vi/{nvi/v_left.c => vi/v_mark.c} | 208 +- usr.bin/vi/{nvi => vi}/v_match.c | 84 +- usr.bin/vi/{nvi => vi}/v_ntext.c | 309 +- usr.bin/vi/{nvi => vi}/v_paragraph.c | 188 +- usr.bin/vi/{nvi => vi}/v_put.c | 31 +- usr.bin/vi/{nvi => vi}/v_redraw.c | 20 +- usr.bin/vi/{nvi => vi}/v_replace.c | 84 +- usr.bin/vi/{nvi => vi}/v_right.c | 121 +- usr.bin/vi/{nvi => vi}/v_screen.c | 22 +- usr.bin/vi/{nvi => vi}/v_scroll.c | 214 +- usr.bin/vi/{nvi => vi}/v_search.c | 349 +- usr.bin/vi/vi/v_section.c | 201 + usr.bin/vi/{nvi => vi}/v_sentence.c | 174 +- usr.bin/vi/{nvi => vi}/v_shift.c | 28 +- usr.bin/vi/{nvi => vi}/v_status.c | 19 +- usr.bin/vi/{nvi => vi}/v_stop.c | 21 +- usr.bin/vi/{nvi => vi}/v_switch.c | 19 +- usr.bin/vi/{nvi => vi}/v_tag.c | 25 +- usr.bin/vi/{nvi => vi}/v_text.c | 325 +- usr.bin/vi/{nvi => vi}/v_ulcase.c | 71 +- usr.bin/vi/{nvi => vi}/v_undo.c | 29 +- usr.bin/vi/{nvi => vi}/v_util.c | 40 +- usr.bin/vi/vi/v_word.c | 569 ++ usr.bin/vi/{nvi => vi}/v_xchar.c | 108 +- usr.bin/vi/{nvi/v_mark.c => vi/v_yank.c} | 77 +- usr.bin/vi/{nvi => vi}/v_z.c | 32 +- usr.bin/vi/{nvi/v_exit.c => vi/v_zexit.c} | 23 +- usr.bin/vi/{nvi => vi}/vcmd.c | 196 +- usr.bin/vi/vi/vcmd.h | 329 + usr.bin/vi/{nvi => vi}/vi.c | 303 +- usr.bin/vi/xaw/xaw_screen.c | 18 +- usr.bin/w/w.c | 8 +- usr.bin/wall/wall.c | 3 +- usr.bin/wc/wc.c | 2 +- usr.bin/whereis/whereis.c | 2 + usr.bin/yacc/yacc.1 | 8 +- usr.sbin/Makefile | 11 +- {sbin => usr.sbin}/XNSrouted/Makefile | 0 {sbin => usr.sbin}/XNSrouted/XNSrouted.8 | 0 {sbin => usr.sbin}/XNSrouted/af.c | 0 {sbin => usr.sbin}/XNSrouted/af.h | 0 {sbin => usr.sbin}/XNSrouted/defs.h | 0 {sbin => usr.sbin}/XNSrouted/if.c | 0 {sbin => usr.sbin}/XNSrouted/input.c | 0 {sbin => usr.sbin}/XNSrouted/interface.h | 0 {sbin => usr.sbin}/XNSrouted/main.c | 0 {sbin => usr.sbin}/XNSrouted/output.c | 0 {sbin => usr.sbin}/XNSrouted/protocol.h | 0 {sbin => usr.sbin}/XNSrouted/startup.c | 0 {sbin => usr.sbin}/XNSrouted/table.h | 0 {sbin => usr.sbin}/XNSrouted/tables.c | 0 {sbin => usr.sbin}/XNSrouted/timer.c | 0 {sbin => usr.sbin}/XNSrouted/tools/query.c | 0 {sbin => usr.sbin}/XNSrouted/trace.c | 0 {sbin => usr.sbin}/XNSrouted/trace.h | 0 usr.sbin/ac/Makefile | 18 + usr.sbin/ac/ac.8 | 165 + usr.sbin/ac/ac.c | 557 ++ usr.sbin/config/config.8 | 6 +- usr.sbin/config/main.c | 37 + usr.sbin/config/mkglue.c | 6 +- usr.sbin/config/mkmakefile.c | 4 + usr.sbin/cron/cron.8 | 2 +- usr.sbin/diskless_cfg/diskless.h | 2 +- usr.sbin/diskless_cfg/diskless_cfg.c | 86 +- usr.sbin/fdcontrol/Makefile | 4 + usr.sbin/fdcontrol/fdcontrol.8 | 77 + usr.sbin/fdcontrol/fdcontrol.c | 100 + usr.sbin/fdformat/Makefile | 25 +- usr.sbin/fdformat/fdformat.1 | 26 +- usr.sbin/fdformat/fdformat.c | 64 +- usr.sbin/flcopy/Makefile | 7 - usr.sbin/flcopy/flcopy.c | 201 - usr.sbin/kbdcontrol/Makefile | 4 + usr.sbin/kbdcontrol/kbdcontrol.1 | 77 + usr.sbin/kbdcontrol/kbdcontrol.c | 566 ++ usr.sbin/kbdcontrol/lex.h | 55 + usr.sbin/kbdcontrol/lex.l | 114 + .../syscons.h => usr.sbin/kbdcontrol/path.h | 2 - usr.sbin/kvm_mkdb/nlist.c | 52 - usr.sbin/lpr/common_source/common.c | 2 +- usr.sbin/lpr/lpr/lpr.c | 2 +- usr.sbin/lptcontrol/Makefile | 4 + usr.sbin/lptcontrol/lptcontrol.1 | 67 + usr.sbin/lptcontrol/lptcontrol.c | 93 + usr.sbin/mrouted/LICENSE | 48 + usr.sbin/mrouted/Makefile | 44 + usr.sbin/mrouted/config.c | 528 + usr.sbin/mrouted/defs.h | 129 + usr.sbin/mrouted/dvmrp.h | 141 + usr.sbin/mrouted/igmp.c | 217 + usr.sbin/mrouted/inet.c | 187 + usr.sbin/mrouted/kern.c | 213 + usr.sbin/mrouted/main.c | 322 + usr.sbin/mrouted/mapper.c | 932 ++ usr.sbin/mrouted/mrinfo.c | 469 + usr.sbin/mrouted/mrouted.8 | 242 + usr.sbin/mrouted/mrouted.conf | 15 + usr.sbin/mrouted/route.c | 900 ++ usr.sbin/mrouted/route.h | 50 + usr.sbin/mrouted/vif.c | 782 ++ usr.sbin/mrouted/vif.h | 47 + usr.sbin/mtree/verify.c | 5 +- usr.sbin/named/named.restart | 2 +- usr.sbin/pwd_mkdb/Makefile | 3 + usr.sbin/pwd_mkdb/pwd_mkdb.8 | 14 + usr.sbin/pwd_mkdb/pwd_mkdb.c | 126 +- {sbin => usr.sbin}/routed/Makefile | 0 {sbin => usr.sbin}/routed/af.c | 0 {sbin => usr.sbin}/routed/af.h | 0 {sbin => usr.sbin}/routed/defs.h | 0 {sbin => usr.sbin}/routed/if.c | 0 {sbin => usr.sbin}/routed/inet.c | 0 {sbin => usr.sbin}/routed/input.c | 0 {sbin => usr.sbin}/routed/interface.h | 1 + {sbin => usr.sbin}/routed/main.c | 0 {sbin => usr.sbin}/routed/output.c | 0 {sbin => usr.sbin}/routed/pathnames.h | 0 {sbin => usr.sbin}/routed/query/Makefile | 0 {sbin => usr.sbin}/routed/query/query.c | 0 {sbin => usr.sbin}/routed/routed.8 | 0 {sbin => usr.sbin}/routed/startup.c | 2 +- {sbin => usr.sbin}/routed/table.h | 0 {sbin => usr.sbin}/routed/tables.c | 0 {sbin => usr.sbin}/routed/timer.c | 0 {sbin => usr.sbin}/routed/trace.c | 0 {sbin => usr.sbin}/routed/trace.h | 0 {sbin => usr.sbin}/routed/trace/Makefile | 0 {sbin => usr.sbin}/routed/trace/trace.c | 0 usr.sbin/sa/Makefile | 8 + usr.sbin/sa/extern.h | 100 + usr.sbin/sa/main.c | 542 ++ usr.sbin/sa/pathnames.h | 35 + usr.sbin/sa/pdb.c | 418 + usr.sbin/sa/sa.8 | 246 + usr.sbin/sa/usrdb.c | 282 + usr.sbin/sendmail/cf/README | 2 +- usr.sbin/sendmail/contrib/expn.pl | 2 +- usr.sbin/sendmail/src/conf.c | 2 +- usr.sbin/sliplogin/slip.hosts | 2 +- usr.sbin/sliplogin/sliplogin.c | 7 +- usr.sbin/slstat/Makefile | 11 + usr.sbin/slstat/slstat.8 | 141 + usr.sbin/slstat/slstat.c | 287 + usr.sbin/vidcontrol/Makefile | 4 + usr.sbin/vidcontrol/decode.c | 74 + usr.sbin/vidcontrol/path.h | 4 + usr.sbin/vidcontrol/vidcontrol.1 | 112 + usr.sbin/vidcontrol/vidcontrol.c | 472 + usr.sbin/xten/Install.notes | 222 + usr.sbin/xten/Makefile | 10 + usr.sbin/xten/xten.1 | 110 + usr.sbin/xten/xten.c | 164 + 2554 files changed, 372282 insertions(+), 68160 deletions(-) create mode 100644 REGISTER.FreeBSD create mode 100644 ROSTER.FreeBSD create mode 100644 TODO-1.1.5 rename bin/ed/{glob.c => glbl.c} (98%) create mode 100644 contrib/FAQ/FreeBSD.FAQ create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.current.policy create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.kdebug.FAQ create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.mailing-list.FAQ create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.ports.supfile create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.slip.dialup.faq create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.standard.supfile create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSD.sup.faq create mode 100644 contrib/FAQ/OTHER-FAQS/FreeBSDvsLinux create mode 100644 contrib/FAQ/OTHER-FAQS/NFS create mode 100644 contrib/FAQ/OTHER-FAQS/Systems.FAQ create mode 100644 contrib/FAQ/code/printcap01/Makefile create mode 100644 contrib/FAQ/code/printcap01/README create mode 100644 contrib/FAQ/code/printcap01/hpf.c create mode 100644 contrib/FAQ/code/printcap01/printcap.sample create mode 100644 contrib/FAQ/code/printcap01/ps2lj3 create mode 100755 contrib/adduser/AddIt create mode 100644 contrib/adduser/README create mode 100644 contrib/adduser/dot.cshrc create mode 100644 contrib/adduser/dot.login create mode 100644 contrib/adduser/dot.profile create mode 100644 contrib/adduser/userids create mode 100755 contrib/configit/ConfigIt create mode 100644 contrib/configit/README create mode 100644 contrib/configit/TODO create mode 100644 contrib/crunch/COPYRIGHT create mode 100644 contrib/crunch/Makefile create mode 100644 contrib/crunch/Makefile.inc create mode 100644 contrib/crunch/README create mode 100644 contrib/crunch/crunchgen/Makefile create mode 100644 contrib/crunch/crunchgen/crunched_main.c create mode 100644 contrib/crunch/crunchgen/crunchgen.1 create mode 100644 contrib/crunch/crunchgen/crunchgen.c create mode 100755 contrib/crunch/crunchgen/mkskel.sh create mode 100644 contrib/crunch/crunchide/Makefile create mode 100644 contrib/crunch/crunchide/crunchide.1 create mode 100644 contrib/crunch/crunchide/crunchide.c create mode 100644 contrib/crunch/examples/Makefile create mode 100644 contrib/crunch/examples/filesystem.conf create mode 100644 contrib/crunch/examples/fixit.conf create mode 100644 contrib/crunch/examples/kcopy.conf create mode 100644 contrib/crunch/examples/really-big.conf create mode 100644 contrib/manctl/Makefile create mode 100644 contrib/manctl/manctl.sh create mode 100644 contrib/xntpd/conf/Config.plain delete mode 100644 contrib/xntpd/gadget/.keep_me delete mode 100644 contrib/xntpd/hints/.keep_me create mode 100755 contrib/xntpd/include/ntp_in.h delete mode 100644 contrib/xntpd/kernel/.keep_me create mode 100644 contrib/xntpd/lib/netof.c delete mode 100644 contrib/xntpd/machines/.keep_me create mode 100644 contrib/xntpd/parse/README.new_clocks create mode 100644 contrib/xntpd/parse/README.parse_clocks delete mode 100644 contrib/xntpd/ppsclock/ppstest/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/genassym/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/os/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/sun/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/sun4c/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/sun4c/conf/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/sun4m/conf/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/sundev/.keep_me delete mode 100644 contrib/xntpd/ppsclock/sys/sys/.keep_me create mode 100644 contrib/xntpd/refclocks/rclk.TRAK create mode 100644 contrib/xntpd/scripts/stats/ensemble.S create mode 100644 contrib/xntpd/scripts/stats/etf.S create mode 100644 contrib/xntpd/scripts/stats/itf.S create mode 100644 contrib/xntpd/scripts/stats/loop.S create mode 100644 contrib/xntpd/scripts/stats/rms.awk create mode 100644 contrib/xntpd/scripts/stats/tdata.S rename contrib/xntpd/{adjtime/.keep_me => xntpd/minpoll} (100%) create mode 100644 contrib/xntpd/xntpd/refclock_trak.c create mode 100755 etc/etc.i386/EXTRACT_bin.sh create mode 100755 etc/etc.i386/EXTRACT_secr.sh create mode 100755 etc/etc.i386/EXTRACT_src.sh rename etc/etc.i386/{floppy.install_notes => README.1ST} (94%) rename etc/etc.i386/{install_notes => README.INSTALL} (87%) create mode 100644 etc/kerberosIV/README create mode 100644 etc/kerberosIV/krb.conf create mode 100644 etc/kerberosIV/krb.realms create mode 100644 etc/login.access create mode 100644 etc/make.conf create mode 100644 etc/minfree create mode 100644 etc/rc.serial create mode 100644 etc/skey.access create mode 100644 etc/termcap.small delete mode 100644 games/hack/COPYRIGHT delete mode 100644 games/hack/Makefile delete mode 100644 games/hack/Makequest delete mode 100644 games/hack/OWNER delete mode 100644 games/hack/Original_READ_ME delete mode 100644 games/hack/READ_ME delete mode 100644 games/hack/alloc.c delete mode 100644 games/hack/config.h delete mode 100644 games/hack/data delete mode 100644 games/hack/date.h delete mode 100644 games/hack/def.edog.h delete mode 100644 games/hack/def.eshk.h delete mode 100644 games/hack/def.flag.h delete mode 100644 games/hack/def.func_tab.h delete mode 100644 games/hack/def.gen.h delete mode 100644 games/hack/def.gold.h delete mode 100644 games/hack/def.mkroom.h delete mode 100644 games/hack/def.monst.h delete mode 100644 games/hack/def.obj.h delete mode 100644 games/hack/def.objclass.h delete mode 100644 games/hack/def.objects.h delete mode 100644 games/hack/def.permonst.h delete mode 100644 games/hack/def.rm.h delete mode 100644 games/hack/def.trap.h delete mode 100644 games/hack/def.wseg.h delete mode 100644 games/hack/hack.6 delete mode 100644 games/hack/hack.Decl.c delete mode 100644 games/hack/hack.apply.c delete mode 100644 games/hack/hack.bones.c delete mode 100644 games/hack/hack.c delete mode 100644 games/hack/hack.cmd.c delete mode 100644 games/hack/hack.do.c delete mode 100644 games/hack/hack.do_name.c delete mode 100644 games/hack/hack.do_wear.c delete mode 100644 games/hack/hack.dog.c delete mode 100644 games/hack/hack.eat.c delete mode 100644 games/hack/hack.end.c delete mode 100644 games/hack/hack.engrave.c delete mode 100644 games/hack/hack.fight.c delete mode 100644 games/hack/hack.fix delete mode 100644 games/hack/hack.h delete mode 100644 games/hack/hack.invent.c delete mode 100644 games/hack/hack.ioctl.c delete mode 100644 games/hack/hack.lev.c delete mode 100644 games/hack/hack.main.c delete mode 100644 games/hack/hack.makemon.c delete mode 100644 games/hack/hack.mfndpos.h delete mode 100644 games/hack/hack.mhitu.c delete mode 100644 games/hack/hack.mklev.c delete mode 100644 games/hack/hack.mkmaze.c delete mode 100644 games/hack/hack.mkobj.c delete mode 100644 games/hack/hack.mkshop.c delete mode 100644 games/hack/hack.mon.c delete mode 100644 games/hack/hack.monst.c delete mode 100644 games/hack/hack.o_init.c delete mode 100644 games/hack/hack.objnam.c delete mode 100644 games/hack/hack.options.c delete mode 100644 games/hack/hack.pager.c delete mode 100644 games/hack/hack.potion.c delete mode 100644 games/hack/hack.pri.c delete mode 100644 games/hack/hack.read.c delete mode 100644 games/hack/hack.rip.c delete mode 100644 games/hack/hack.rumors.c delete mode 100644 games/hack/hack.save.c delete mode 100644 games/hack/hack.search.c delete mode 100644 games/hack/hack.sh delete mode 100644 games/hack/hack.shk.c delete mode 100644 games/hack/hack.shknam.c delete mode 100644 games/hack/hack.steal.c delete mode 100644 games/hack/hack.termcap.c delete mode 100644 games/hack/hack.timeout.c delete mode 100644 games/hack/hack.topl.c delete mode 100644 games/hack/hack.track.c delete mode 100644 games/hack/hack.trap.c delete mode 100644 games/hack/hack.tty.c delete mode 100644 games/hack/hack.u_init.c delete mode 100644 games/hack/hack.unix.c delete mode 100644 games/hack/hack.vault.c delete mode 100644 games/hack/hack.version.c delete mode 100644 games/hack/hack.wield.c delete mode 100644 games/hack/hack.wizard.c delete mode 100644 games/hack/hack.worm.c delete mode 100644 games/hack/hack.worn.c delete mode 100644 games/hack/hack.zap.c delete mode 100644 games/hack/help delete mode 100644 games/hack/hh delete mode 100644 games/hack/makedefs.c delete mode 100644 games/hack/rnd.c delete mode 100644 games/hack/rumors rename gnu/lib/libg++/g++-include/{gen => }/AVLMap.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/AVLMap.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/AVLSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/AVLSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/AVec.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/AVec.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/BSTSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/BSTSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Bag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Bag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHMap.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHMap.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHNode.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHNode.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/CHSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/DLDeque.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/DLDeque.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/DLList.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/DLList.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Deque.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Deque.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/FPQueue.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/FPQueue.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/FPStack.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/FPStack.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/FPlex.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/FPlex.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/List.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/List.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/MPlex.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/MPlex.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Map.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Map.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OSLBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OSLBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OSLSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OSLSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OXPBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OXPBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OXPSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/OXPSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/PHPQ.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/PHPQ.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/PQ.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/PQ.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/PSList.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/PVec.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Plex.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Plex.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Queue.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Queue.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/RAVLMap.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/RAVLMap.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/RPlex.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/RPlex.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLList.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLList.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLQueue.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLQueue.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLStack.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SLStack.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Set.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Set.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SkipBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SkipBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SkipMap.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SkipMap.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SkipSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SkipSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayMap.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayMap.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayNode.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayNode.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayPQ.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplayPQ.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplaySet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/SplaySet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Stack.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Stack.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VHBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VHBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VHMap.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VHMap.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VHSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VHSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VOHSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VOHSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VQueue.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VQueue.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VStack.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/VStack.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Vec.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/Vec.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPBag.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPBag.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPDeque.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPDeque.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPPQ.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPPQ.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPQueue.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPQueue.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPSet.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPSet.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPStack.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPStack.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPlex.ccP (100%) rename gnu/lib/libg++/g++-include/{gen => }/XPlex.hP (100%) delete mode 100644 gnu/lib/libg++/g++-include/assert.h delete mode 100644 gnu/lib/libg++/g++-include/bstring.h delete mode 100644 gnu/lib/libg++/g++-include/ctype.h delete mode 100644 gnu/lib/libg++/g++-include/curses.h rename gnu/lib/libg++/g++-include/{gen => }/defs.hP (100%) delete mode 100644 gnu/lib/libg++/g++-include/dir.h delete mode 100644 gnu/lib/libg++/g++-include/dirent.h delete mode 100644 gnu/lib/libg++/g++-include/errno.h delete mode 100644 gnu/lib/libg++/g++-include/fcntl.h delete mode 100644 gnu/lib/libg++/g++-include/grp.h rename gnu/lib/libg++/g++-include/{gen => }/intSList.hP (100%) rename gnu/lib/libg++/g++-include/{gen => }/intVec.hP (100%) delete mode 100644 gnu/lib/libg++/g++-include/math.h delete mode 100644 gnu/lib/libg++/g++-include/memory.h delete mode 100644 gnu/lib/libg++/g++-include/netdb.h delete mode 100644 gnu/lib/libg++/g++-include/pwd.h delete mode 100644 gnu/lib/libg++/g++-include/setjmp.h delete mode 100644 gnu/lib/libg++/g++-include/signal.h delete mode 100644 gnu/lib/libg++/g++-include/stdarg.h delete mode 100644 gnu/lib/libg++/g++-include/stddef.h delete mode 100644 gnu/lib/libg++/g++-include/stdio.h delete mode 100644 gnu/lib/libg++/g++-include/stdlib.h delete mode 100644 gnu/lib/libg++/g++-include/string.h delete mode 100644 gnu/lib/libg++/g++-include/strings.h delete mode 100644 gnu/lib/libg++/g++-include/sys/dir.h delete mode 100644 gnu/lib/libg++/g++-include/sys/fcntl.h delete mode 100644 gnu/lib/libg++/g++-include/sys/file.h delete mode 100644 gnu/lib/libg++/g++-include/sys/mman.h delete mode 100644 gnu/lib/libg++/g++-include/sys/param.h delete mode 100644 gnu/lib/libg++/g++-include/sys/resource.h delete mode 100644 gnu/lib/libg++/g++-include/sys/select.h delete mode 100644 gnu/lib/libg++/g++-include/sys/signal.h delete mode 100644 gnu/lib/libg++/g++-include/sys/socket.h delete mode 100644 gnu/lib/libg++/g++-include/sys/stat.h delete mode 100644 gnu/lib/libg++/g++-include/sys/time.h delete mode 100644 gnu/lib/libg++/g++-include/sys/times.h delete mode 100644 gnu/lib/libg++/g++-include/sys/types.h delete mode 100644 gnu/lib/libg++/g++-include/sys/wait.h delete mode 100644 gnu/lib/libg++/g++-include/time.h delete mode 100644 gnu/lib/libg++/g++-include/unistd.h rename gnu/lib/libg++/{g++-include => include}/values.h (96%) create mode 100644 gnu/lib/libreadline/COPYING create mode 100644 gnu/lib/libreadline/ChangeLog create mode 100644 gnu/lib/libreadline/Makefile create mode 100644 gnu/lib/libreadline/README create mode 100644 gnu/lib/libreadline/README.FreeBSD create mode 100644 gnu/lib/libreadline/STANDALONE create mode 100644 gnu/lib/libreadline/VERSION create mode 100644 gnu/lib/libreadline/ansi_stdlib.h create mode 100644 gnu/lib/libreadline/bind.c create mode 100644 gnu/lib/libreadline/complete.c create mode 100644 gnu/lib/libreadline/display.c create mode 100644 gnu/lib/libreadline/doc/Makefile create mode 100644 gnu/lib/libreadline/doc/hist.texinfo create mode 100644 gnu/lib/libreadline/doc/hstech.texinfo create mode 100644 gnu/lib/libreadline/doc/hsuser.texinfo create mode 100644 gnu/lib/libreadline/doc/rlman.texinfo create mode 100644 gnu/lib/libreadline/doc/rltech.texinfo create mode 100644 gnu/lib/libreadline/doc/rluser.texinfo create mode 100644 gnu/lib/libreadline/doc/texindex.c create mode 100644 gnu/lib/libreadline/emacs_keymap.c create mode 100644 gnu/lib/libreadline/examples/Inputrc create mode 100644 gnu/lib/libreadline/examples/Makefile create mode 100644 gnu/lib/libreadline/examples/fileman.c create mode 100644 gnu/lib/libreadline/examples/manexamp.c rename gnu/{usr.bin/gdb/readline => lib/libreadline}/funmap.c (57%) create mode 100644 gnu/lib/libreadline/history.c create mode 100644 gnu/lib/libreadline/isearch.c rename gnu/{usr.bin/gdb/readline => lib/libreadline}/keymaps.c (75%) create mode 100644 gnu/lib/libreadline/memalloc.h create mode 100644 gnu/lib/libreadline/parens.c create mode 100644 gnu/lib/libreadline/posixstat.h create mode 100644 gnu/lib/libreadline/readline.c create mode 100644 gnu/lib/libreadline/readline/chardefs.h rename gnu/{usr.bin/gdb => lib/libreadline}/readline/history.h (69%) create mode 100644 gnu/lib/libreadline/readline/keymaps.h create mode 100644 gnu/lib/libreadline/readline/readline.h create mode 100644 gnu/lib/libreadline/readline/tilde.h create mode 100644 gnu/lib/libreadline/rlconf.h create mode 100644 gnu/lib/libreadline/rldefs.h create mode 100644 gnu/lib/libreadline/rltty.c create mode 100644 gnu/lib/libreadline/search.c create mode 100644 gnu/lib/libreadline/signals.c create mode 100644 gnu/lib/libreadline/tcsh_hack.readme create mode 100644 gnu/lib/libreadline/tilde.c create mode 100644 gnu/lib/libreadline/vi_keymap.c create mode 100644 gnu/lib/libreadline/vi_mode.c create mode 100644 gnu/lib/libreadline/xmalloc.c create mode 100644 gnu/libexec/uucp/NEWS rename gnu/libexec/uucp/common_sources/{conf.h => config.h} (89%) create mode 100644 gnu/libexec/uucp/contrib/amiga.c create mode 100644 gnu/libexec/uucp/contrib/dialHDB.c create mode 100644 gnu/libexec/uucp/contrib/uucomp.shar create mode 100644 gnu/libexec/uucp/contrib/uudemon.shar create mode 100644 gnu/libexec/uucp/contrib/uupoll.shar create mode 100755 gnu/libexec/uucp/contrib/uureroute.perl create mode 100755 gnu/libexec/uucp/contrib/uuxconv create mode 100644 gnu/libexec/uucp/doc/uucp.texi create mode 100644 gnu/libexec/uucp/libunix/corrup.c create mode 100644 gnu/libexec/uucp/libunix/pipe.c create mode 100644 gnu/libexec/uucp/libunix/priv.c create mode 100644 gnu/libexec/uucp/libuuconf/runuxq.c create mode 100644 gnu/libexec/uucp/libuucp/strtou.c rename gnu/libexec/uucp/sample/{call => call.sample} (100%) rename gnu/libexec/uucp/sample/{config => config.sample} (100%) rename gnu/libexec/uucp/sample/{dial => dial.sample} (85%) rename gnu/libexec/uucp/sample/{dialcode => dialcode.sample} (100%) rename gnu/libexec/uucp/sample/{passwd => passwd.sample} (100%) rename gnu/libexec/uucp/sample/{port => port.sample} (100%) rename gnu/libexec/uucp/sample/{sys1 => sys1.sample} (100%) rename gnu/libexec/uucp/sample/{sys2 => sys2.sample} (100%) create mode 100644 gnu/usr.bin/cc25/Freebsd.gcc258.patch create mode 100644 gnu/usr.bin/cc25/Makefile create mode 100644 gnu/usr.bin/cc25/README create mode 100644 gnu/usr.bin/cc25/gcc258-freebsd.patch create mode 100755 gnu/usr.bin/cc25/gnu2bsd.tcl create mode 100644 gnu/usr.bin/cc25/usr.bin.cpp/Makefile create mode 100644 gnu/usr.bin/cc25/usr.bin.cpp/cpp.script create mode 100644 gnu/usr.bin/cc25/usr.bin.f77/Makefile create mode 100644 gnu/usr.bin/cc25/usr.bin.f77/f77.script create mode 100644 gnu/usr.bin/gdb/COPYING.LIB create mode 100644 gnu/usr.bin/gdb/README.FreeBSD create mode 100644 gnu/usr.bin/gdb/VERSION create mode 100644 gnu/usr.bin/gdb/bfd/COPYING create mode 100644 gnu/usr.bin/gdb/bfd/Makefile create mode 100644 gnu/usr.bin/gdb/bfd/README.FreeBSD create mode 100644 gnu/usr.bin/gdb/bfd/VERSION create mode 100644 gnu/usr.bin/gdb/bfd/aout-target.h create mode 100644 gnu/usr.bin/gdb/bfd/aout32.c create mode 100644 gnu/usr.bin/gdb/bfd/aoutx.h create mode 100644 gnu/usr.bin/gdb/bfd/archive.c create mode 100644 gnu/usr.bin/gdb/bfd/archures.c create mode 100644 gnu/usr.bin/gdb/bfd/bfd.c create mode 100644 gnu/usr.bin/gdb/bfd/bfd.h create mode 100644 gnu/usr.bin/gdb/bfd/cache.c create mode 100644 gnu/usr.bin/gdb/bfd/coffgen.c create mode 100644 gnu/usr.bin/gdb/bfd/core.c create mode 100644 gnu/usr.bin/gdb/bfd/cpu-i386.c create mode 100644 gnu/usr.bin/gdb/bfd/ctor.c create mode 100644 gnu/usr.bin/gdb/bfd/ecoff.c create mode 100644 gnu/usr.bin/gdb/bfd/elf.c create mode 100644 gnu/usr.bin/gdb/bfd/format.c create mode 100644 gnu/usr.bin/gdb/bfd/freebsd386.c create mode 100644 gnu/usr.bin/gdb/bfd/init.c create mode 100644 gnu/usr.bin/gdb/bfd/libaout.h create mode 100644 gnu/usr.bin/gdb/bfd/libbfd.c create mode 100644 gnu/usr.bin/gdb/bfd/libbfd.h create mode 100644 gnu/usr.bin/gdb/bfd/libcoff.h create mode 100644 gnu/usr.bin/gdb/bfd/libecoff.h create mode 100644 gnu/usr.bin/gdb/bfd/libelf.h create mode 100644 gnu/usr.bin/gdb/bfd/opncls.c create mode 100644 gnu/usr.bin/gdb/bfd/reloc.c create mode 100644 gnu/usr.bin/gdb/bfd/seclet.c create mode 100644 gnu/usr.bin/gdb/bfd/seclet.h create mode 100644 gnu/usr.bin/gdb/bfd/section.c create mode 100644 gnu/usr.bin/gdb/bfd/srec.c create mode 100644 gnu/usr.bin/gdb/bfd/stab-syms.c create mode 100644 gnu/usr.bin/gdb/bfd/syms.c create mode 100644 gnu/usr.bin/gdb/bfd/sysdep.h create mode 100644 gnu/usr.bin/gdb/bfd/targets.c create mode 100644 gnu/usr.bin/gdb/bfd/trad-core.c create mode 100644 gnu/usr.bin/gdb/doc/ChangeLog create mode 100644 gnu/usr.bin/gdb/doc/Makefile create mode 100644 gnu/usr.bin/gdb/doc/Makefile.in create mode 100644 gnu/usr.bin/gdb/doc/a4rc.sed create mode 100644 gnu/usr.bin/gdb/doc/all-cfg.texi create mode 100755 gnu/usr.bin/gdb/doc/config.status create mode 100644 gnu/usr.bin/gdb/doc/configure.in create mode 100644 gnu/usr.bin/gdb/doc/gdb-cfg.texi create mode 100644 gnu/usr.bin/gdb/doc/gdb.info create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-1 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-2 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-3 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-4 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-5 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-6 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-7 create mode 100644 gnu/usr.bin/gdb/doc/gdb.info-8 create mode 100644 gnu/usr.bin/gdb/doc/gdb.texinfo create mode 100644 gnu/usr.bin/gdb/doc/gdbint.texinfo create mode 100644 gnu/usr.bin/gdb/doc/h8-cfg.texi create mode 100644 gnu/usr.bin/gdb/doc/libgdb.texinfo create mode 100644 gnu/usr.bin/gdb/doc/lpsrc.sed create mode 100644 gnu/usr.bin/gdb/doc/psrc.sed create mode 100644 gnu/usr.bin/gdb/doc/refcard.ps create mode 100644 gnu/usr.bin/gdb/doc/refcard.tex create mode 100644 gnu/usr.bin/gdb/doc/remote.texi create mode 100644 gnu/usr.bin/gdb/doc/stabs.texinfo delete mode 100644 gnu/usr.bin/gdb/gdb.1 create mode 100644 gnu/usr.bin/gdb/gdb/COPYING create mode 100644 gnu/usr.bin/gdb/gdb/Makefile create mode 100644 gnu/usr.bin/gdb/gdb/ansidecl.h create mode 100644 gnu/usr.bin/gdb/gdb/aout/aout64.h create mode 100644 gnu/usr.bin/gdb/gdb/aout/ar.h create mode 100644 gnu/usr.bin/gdb/gdb/aout/ranlib.h create mode 100644 gnu/usr.bin/gdb/gdb/aout/stab.def create mode 100644 gnu/usr.bin/gdb/gdb/aout/stab_gnu.h create mode 100644 gnu/usr.bin/gdb/gdb/blockframe.c create mode 100644 gnu/usr.bin/gdb/gdb/breakpoint.c create mode 100644 gnu/usr.bin/gdb/gdb/breakpoint.h create mode 100644 gnu/usr.bin/gdb/gdb/buildsym.c create mode 100644 gnu/usr.bin/gdb/gdb/buildsym.h create mode 100644 gnu/usr.bin/gdb/gdb/c-exp.y create mode 100644 gnu/usr.bin/gdb/gdb/c-lang.c create mode 100644 gnu/usr.bin/gdb/gdb/c-lang.h create mode 100644 gnu/usr.bin/gdb/gdb/c-typeprint.c create mode 100644 gnu/usr.bin/gdb/gdb/c-valprint.c create mode 100644 gnu/usr.bin/gdb/gdb/call-cmds.h create mode 100644 gnu/usr.bin/gdb/gdb/ch-exp.y create mode 100644 gnu/usr.bin/gdb/gdb/ch-lang.c create mode 100644 gnu/usr.bin/gdb/gdb/ch-lang.h create mode 100644 gnu/usr.bin/gdb/gdb/ch-typeprint.c create mode 100644 gnu/usr.bin/gdb/gdb/ch-valprint.c create mode 100644 gnu/usr.bin/gdb/gdb/coff/ecoff.h create mode 100644 gnu/usr.bin/gdb/gdb/coff/internal.h create mode 100644 gnu/usr.bin/gdb/gdb/coff/sym.h create mode 100644 gnu/usr.bin/gdb/gdb/coff/symconst.h create mode 100644 gnu/usr.bin/gdb/gdb/coffread.c create mode 100644 gnu/usr.bin/gdb/gdb/command.c create mode 100644 gnu/usr.bin/gdb/gdb/command.h create mode 100644 gnu/usr.bin/gdb/gdb/complaints.c create mode 100644 gnu/usr.bin/gdb/gdb/complaints.h create mode 100644 gnu/usr.bin/gdb/gdb/copying.c create mode 100644 gnu/usr.bin/gdb/gdb/core.c create mode 100644 gnu/usr.bin/gdb/gdb/coredep.c create mode 100644 gnu/usr.bin/gdb/gdb/corelow.c create mode 100644 gnu/usr.bin/gdb/gdb/cp-valprint.c create mode 100644 gnu/usr.bin/gdb/gdb/dbxread.c create mode 100644 gnu/usr.bin/gdb/gdb/dcache.c create mode 100644 gnu/usr.bin/gdb/gdb/dcache.h create mode 100644 gnu/usr.bin/gdb/gdb/defs.h create mode 100644 gnu/usr.bin/gdb/gdb/demangle.c create mode 100644 gnu/usr.bin/gdb/gdb/demangle.h create mode 100644 gnu/usr.bin/gdb/gdb/dis-asm.h create mode 100644 gnu/usr.bin/gdb/gdb/dis-buf.c create mode 100644 gnu/usr.bin/gdb/gdb/dwarfread.c create mode 100644 gnu/usr.bin/gdb/gdb/elf/common.h create mode 100644 gnu/usr.bin/gdb/gdb/elf/dwarf.h create mode 100644 gnu/usr.bin/gdb/gdb/elf/external.h create mode 100644 gnu/usr.bin/gdb/gdb/elf/internal.h create mode 100644 gnu/usr.bin/gdb/gdb/elfread.c create mode 100644 gnu/usr.bin/gdb/gdb/environ.c create mode 100644 gnu/usr.bin/gdb/gdb/environ.h create mode 100644 gnu/usr.bin/gdb/gdb/eval.c create mode 100644 gnu/usr.bin/gdb/gdb/exec.c create mode 100644 gnu/usr.bin/gdb/gdb/expprint.c create mode 100644 gnu/usr.bin/gdb/gdb/expression.h create mode 100644 gnu/usr.bin/gdb/gdb/findvar.c create mode 100644 gnu/usr.bin/gdb/gdb/fopen-same.h create mode 100644 gnu/usr.bin/gdb/gdb/fork-child.c create mode 100644 gnu/usr.bin/gdb/gdb/frame.h create mode 100644 gnu/usr.bin/gdb/gdb/freebsd-nat.c create mode 100644 gnu/usr.bin/gdb/gdb/freebsd-solib.c create mode 100644 gnu/usr.bin/gdb/gdb/gdb-stabs.h create mode 100644 gnu/usr.bin/gdb/gdb/gdb.1 create mode 100644 gnu/usr.bin/gdb/gdb/gdbcmd.h create mode 100644 gnu/usr.bin/gdb/gdb/gdbcore.h create mode 100644 gnu/usr.bin/gdb/gdb/gdbtypes.c create mode 100644 gnu/usr.bin/gdb/gdb/gdbtypes.h create mode 100644 gnu/usr.bin/gdb/gdb/getopt.h create mode 100644 gnu/usr.bin/gdb/gdb/i386-dis.c create mode 100644 gnu/usr.bin/gdb/gdb/i386-pinsn.c create mode 100644 gnu/usr.bin/gdb/gdb/i386-tdep.c create mode 100644 gnu/usr.bin/gdb/gdb/infcmd.c create mode 100644 gnu/usr.bin/gdb/gdb/inferior.h create mode 100644 gnu/usr.bin/gdb/gdb/inflow.c create mode 100644 gnu/usr.bin/gdb/gdb/infptrace.c create mode 100644 gnu/usr.bin/gdb/gdb/infrun.c create mode 100644 gnu/usr.bin/gdb/gdb/inftarg.c create mode 100644 gnu/usr.bin/gdb/gdb/init.c create mode 100644 gnu/usr.bin/gdb/gdb/language.c create mode 100644 gnu/usr.bin/gdb/gdb/language.h create mode 100644 gnu/usr.bin/gdb/gdb/m2-exp.y create mode 100644 gnu/usr.bin/gdb/gdb/m2-lang.c create mode 100644 gnu/usr.bin/gdb/gdb/m2-lang.h create mode 100644 gnu/usr.bin/gdb/gdb/m2-typeprint.c create mode 100644 gnu/usr.bin/gdb/gdb/m2-valprint.c create mode 100644 gnu/usr.bin/gdb/gdb/main.c create mode 100644 gnu/usr.bin/gdb/gdb/maint.c create mode 100644 gnu/usr.bin/gdb/gdb/mem-break.c create mode 100644 gnu/usr.bin/gdb/gdb/minsyms.c create mode 100644 gnu/usr.bin/gdb/gdb/mipsread.c create mode 100644 gnu/usr.bin/gdb/gdb/nlmread.c create mode 100644 gnu/usr.bin/gdb/gdb/nm.h create mode 100644 gnu/usr.bin/gdb/gdb/objfiles.c create mode 100644 gnu/usr.bin/gdb/gdb/objfiles.h create mode 100644 gnu/usr.bin/gdb/gdb/obstack.h create mode 100644 gnu/usr.bin/gdb/gdb/parse.c create mode 100644 gnu/usr.bin/gdb/gdb/parser-defs.h create mode 100644 gnu/usr.bin/gdb/gdb/partial-stab.h create mode 100644 gnu/usr.bin/gdb/gdb/printcmd.c create mode 100644 gnu/usr.bin/gdb/gdb/putenv.c create mode 100644 gnu/usr.bin/gdb/gdb/regex.c create mode 100644 gnu/usr.bin/gdb/gdb/regex.h create mode 100644 gnu/usr.bin/gdb/gdb/remote-utils.c create mode 100644 gnu/usr.bin/gdb/gdb/remote-utils.h create mode 100644 gnu/usr.bin/gdb/gdb/remote.c create mode 100644 gnu/usr.bin/gdb/gdb/ser-unix.c create mode 100644 gnu/usr.bin/gdb/gdb/serial.c create mode 100644 gnu/usr.bin/gdb/gdb/serial.h create mode 100644 gnu/usr.bin/gdb/gdb/signals.h create mode 100644 gnu/usr.bin/gdb/gdb/solib.h create mode 100644 gnu/usr.bin/gdb/gdb/source.c create mode 100644 gnu/usr.bin/gdb/gdb/stabsread.c create mode 100644 gnu/usr.bin/gdb/gdb/stabsread.h create mode 100644 gnu/usr.bin/gdb/gdb/stack.c create mode 100644 gnu/usr.bin/gdb/gdb/symfile.c create mode 100644 gnu/usr.bin/gdb/gdb/symfile.h create mode 100644 gnu/usr.bin/gdb/gdb/symmisc.c create mode 100644 gnu/usr.bin/gdb/gdb/symtab.c create mode 100644 gnu/usr.bin/gdb/gdb/symtab.h create mode 100644 gnu/usr.bin/gdb/gdb/target.c create mode 100644 gnu/usr.bin/gdb/gdb/target.h create mode 100644 gnu/usr.bin/gdb/gdb/terminal.h create mode 100644 gnu/usr.bin/gdb/gdb/thread.c create mode 100644 gnu/usr.bin/gdb/gdb/thread.h create mode 100644 gnu/usr.bin/gdb/gdb/tm-i386v.h create mode 100644 gnu/usr.bin/gdb/gdb/tm.h create mode 100644 gnu/usr.bin/gdb/gdb/typeprint.c create mode 100644 gnu/usr.bin/gdb/gdb/typeprint.h create mode 100644 gnu/usr.bin/gdb/gdb/utils.c create mode 100644 gnu/usr.bin/gdb/gdb/valarith.c create mode 100644 gnu/usr.bin/gdb/gdb/valops.c create mode 100644 gnu/usr.bin/gdb/gdb/valprint.c create mode 100644 gnu/usr.bin/gdb/gdb/valprint.h create mode 100644 gnu/usr.bin/gdb/gdb/value.h create mode 100644 gnu/usr.bin/gdb/gdb/values.c create mode 100644 gnu/usr.bin/gdb/gdb/version.c create mode 100644 gnu/usr.bin/gdb/gdb/wait.h create mode 100644 gnu/usr.bin/gdb/gdb/xm.h create mode 100644 gnu/usr.bin/gdb/libiberty/COPYING.LIB create mode 100644 gnu/usr.bin/gdb/libiberty/Makefile create mode 100644 gnu/usr.bin/gdb/libiberty/README.FreeBSD create mode 100644 gnu/usr.bin/gdb/libiberty/alloca-conf.h create mode 100644 gnu/usr.bin/gdb/libiberty/argv.c create mode 100644 gnu/usr.bin/gdb/libiberty/basename.c create mode 100644 gnu/usr.bin/gdb/libiberty/concat.c create mode 100644 gnu/usr.bin/gdb/libiberty/config.h create mode 100644 gnu/usr.bin/gdb/libiberty/cplus-dem.c create mode 100644 gnu/usr.bin/gdb/libiberty/fdmatch.c create mode 100644 gnu/usr.bin/gdb/libiberty/getopt.c create mode 100644 gnu/usr.bin/gdb/libiberty/getopt1.c create mode 100644 gnu/usr.bin/gdb/libiberty/ieee-float.c create mode 100644 gnu/usr.bin/gdb/libiberty/ieee-float.h create mode 100644 gnu/usr.bin/gdb/libiberty/obstack.c create mode 100644 gnu/usr.bin/gdb/libiberty/sigsetmask.c create mode 100644 gnu/usr.bin/gdb/libiberty/spaces.c create mode 100644 gnu/usr.bin/gdb/libiberty/strerror.c create mode 100644 gnu/usr.bin/gdb/libiberty/strsignal.c create mode 100644 gnu/usr.bin/gdb/libiberty/xmalloc.c create mode 100644 gnu/usr.bin/gdb/mmalloc/Makefile create mode 100644 gnu/usr.bin/gdb/mmalloc/README.FreeBSD create mode 100644 gnu/usr.bin/gdb/mmalloc/attach.c create mode 100644 gnu/usr.bin/gdb/mmalloc/detach.c create mode 100644 gnu/usr.bin/gdb/mmalloc/keys.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mcalloc.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mfree.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mmalloc.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mmalloc.h create mode 100644 gnu/usr.bin/gdb/mmalloc/mmalloc.texi create mode 100644 gnu/usr.bin/gdb/mmalloc/mmap-sup.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mmcheck.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mmemalign.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mmstats.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mmtrace.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mrealloc.c create mode 100644 gnu/usr.bin/gdb/mmalloc/mvalloc.c create mode 100644 gnu/usr.bin/gdb/mmalloc/sbrk-sup.c delete mode 100644 gnu/usr.bin/gdb/readline/ChangeLog delete mode 100644 gnu/usr.bin/gdb/readline/Makefile.gnu delete mode 100644 gnu/usr.bin/gdb/readline/chardefs.h delete mode 100644 gnu/usr.bin/gdb/readline/emacs_keymap.c delete mode 100644 gnu/usr.bin/gdb/readline/history.c delete mode 100644 gnu/usr.bin/gdb/readline/keymaps.h delete mode 100644 gnu/usr.bin/gdb/readline/readline.c delete mode 100644 gnu/usr.bin/gdb/readline/readline.h delete mode 100644 gnu/usr.bin/gdb/readline/vi_keymap.c delete mode 100644 gnu/usr.bin/gdb/readline/vi_mode.c create mode 100644 gnu/usr.bin/kgdb/COPYING rename gnu/usr.bin/{gdb => kgdb}/ChangeLog (100%) rename gnu/usr.bin/{gdb => kgdb}/Gdbinit (100%) create mode 100644 gnu/usr.bin/kgdb/Makefile rename gnu/usr.bin/{gdb => kgdb}/Makefile.dist (100%) rename gnu/usr.bin/{gdb => kgdb}/Projects (100%) rename gnu/usr.bin/{gdb => kgdb}/README.gnu (100%) rename gnu/usr.bin/{gdb => kgdb}/XGdbinit.samp (100%) rename gnu/usr.bin/{gdb => kgdb}/Xgdb.ad (100%) rename gnu/usr.bin/{gdb => kgdb}/blockframe.c (100%) rename gnu/usr.bin/{gdb => kgdb}/breakpoint.c (100%) rename gnu/usr.bin/{gdb => kgdb}/command.c (100%) rename gnu/usr.bin/{gdb => kgdb}/command.h (100%) rename gnu/usr.bin/{gdb => kgdb}/config/Makefile.i386 (100%) rename gnu/usr.bin/{gdb => kgdb}/config/default-dep.c (100%) rename gnu/usr.bin/{gdb => kgdb}/config/i386-dep.c (100%) rename gnu/usr.bin/{gdb => kgdb}/config/i386-pinsn.c (100%) rename gnu/usr.bin/{gdb => kgdb}/config/i386bsd-dep.c (99%) rename gnu/usr.bin/{gdb => kgdb}/config/m-i386-sv32.h (100%) rename gnu/usr.bin/{gdb => kgdb}/config/m-i386.h (100%) rename gnu/usr.bin/{gdb => kgdb}/config/m-i386bsd.h (100%) rename gnu/usr.bin/{gdb => kgdb}/config/m-i386g-sv32.h (100%) rename gnu/usr.bin/{gdb => kgdb}/config/m-i386gas.h (100%) rename gnu/usr.bin/{gdb => kgdb}/copying.c (100%) rename gnu/usr.bin/{gdb => kgdb}/core.c (100%) rename gnu/usr.bin/{gdb => kgdb}/cplus-dem.c (100%) rename gnu/usr.bin/{gdb => kgdb}/dbxread.c (100%) rename gnu/usr.bin/{gdb => kgdb}/defs.h (100%) rename gnu/usr.bin/{gdb => kgdb}/environ.c (100%) rename gnu/usr.bin/{gdb => kgdb}/environ.h (100%) rename gnu/usr.bin/{gdb => kgdb}/eval.c (100%) rename gnu/usr.bin/{gdb => kgdb}/expprint.c (100%) rename gnu/usr.bin/{gdb => kgdb}/expread.y (100%) rename gnu/usr.bin/{gdb => kgdb}/expression.h (100%) rename gnu/usr.bin/{gdb => kgdb}/findvar.c (100%) rename gnu/usr.bin/{gdb => kgdb}/frame.h (100%) rename gnu/usr.bin/{gdb => kgdb}/getpagesize.h (100%) rename gnu/usr.bin/{gdb => kgdb}/infcmd.c (100%) rename gnu/usr.bin/{gdb => kgdb}/inferior.h (100%) rename gnu/usr.bin/{gdb => kgdb}/inflow.c (100%) rename gnu/usr.bin/{gdb => kgdb}/infrun.c (100%) create mode 100644 gnu/usr.bin/kgdb/kgdb.1 rename gnu/usr.bin/{gdb => kgdb}/kgdb_proto.h (95%) rename gnu/usr.bin/{gdb => kgdb}/main.c (99%) rename gnu/usr.bin/{gdb => kgdb}/ngdb.i386/Makefile (100%) rename gnu/usr.bin/{gdb => kgdb}/obstack.c (100%) rename gnu/usr.bin/{gdb => kgdb}/obstack.h (100%) rename gnu/usr.bin/{gdb => kgdb}/printcmd.c (100%) rename gnu/usr.bin/{gdb => kgdb}/regex.c (100%) rename gnu/usr.bin/{gdb => kgdb}/regex.h (100%) rename gnu/usr.bin/{gdb => kgdb}/remote-sl.c (100%) rename gnu/usr.bin/{gdb => kgdb}/remote.c (99%) rename gnu/usr.bin/{gdb => kgdb}/source.c (100%) rename gnu/usr.bin/{gdb => kgdb}/stab.def (100%) rename gnu/usr.bin/{gdb => kgdb}/stack.c (100%) rename gnu/usr.bin/{gdb => kgdb}/symmisc.c (100%) rename gnu/usr.bin/{gdb => kgdb}/symseg.h (100%) rename gnu/usr.bin/{gdb => kgdb}/symtab.c (99%) rename gnu/usr.bin/{gdb => kgdb}/symtab.h (100%) rename gnu/usr.bin/{gdb => kgdb}/utils.c (99%) rename gnu/usr.bin/{gdb => kgdb}/valarith.c (100%) rename gnu/usr.bin/{gdb => kgdb}/valops.c (100%) rename gnu/usr.bin/{gdb => kgdb}/valprint.c (100%) rename gnu/usr.bin/{gdb => kgdb}/value.h (100%) rename gnu/usr.bin/{gdb => kgdb}/values.c (100%) rename gnu/usr.bin/{gdb => kgdb}/version.c (100%) rename gnu/usr.bin/{gdb => kgdb}/wait.h (100%) rename gnu/usr.bin/{gdb => kgdb}/xgdb/Makefile (100%) rename gnu/usr.bin/{gdb => kgdb}/xgdb/xgdb.c (99%) rename gnu/usr.bin/man/catman/{catman => catman.sh} (60%) rename contrib/xntpd/compilers/.keep_me => gnu/usr.bin/ptx/.stamp-h.in (100%) create mode 100644 gnu/usr.bin/ptx/COPYING create mode 100644 gnu/usr.bin/ptx/ChangeLog create mode 100644 gnu/usr.bin/ptx/Makefile create mode 100644 gnu/usr.bin/ptx/NEWS create mode 100644 gnu/usr.bin/ptx/README create mode 100644 gnu/usr.bin/ptx/THANKS create mode 100644 gnu/usr.bin/ptx/TODO create mode 100644 gnu/usr.bin/ptx/alloca.c create mode 100644 gnu/usr.bin/ptx/argmatch.c create mode 100644 gnu/usr.bin/ptx/bumpalloc.h create mode 100644 gnu/usr.bin/ptx/check-out create mode 100644 gnu/usr.bin/ptx/config.h create mode 100644 gnu/usr.bin/ptx/diacrit.c create mode 100644 gnu/usr.bin/ptx/diacrit.h create mode 100644 gnu/usr.bin/ptx/error.c create mode 100644 gnu/usr.bin/ptx/examples/README create mode 100644 gnu/usr.bin/ptx/examples/ajay/Makefile create mode 100644 gnu/usr.bin/ptx/examples/ajay/README create mode 100644 gnu/usr.bin/ptx/examples/ajay/footer.tex create mode 100644 gnu/usr.bin/ptx/examples/ajay/header.tex create mode 100644 gnu/usr.bin/ptx/examples/ajay/tip.forgptx create mode 100644 gnu/usr.bin/ptx/examples/ajay/x.pl create mode 100644 gnu/usr.bin/ptx/examples/ignore/README create mode 100644 gnu/usr.bin/ptx/examples/ignore/bix create mode 100644 gnu/usr.bin/ptx/examples/ignore/eign create mode 100755 gnu/usr.bin/ptx/examples/include.pl create mode 100644 gnu/usr.bin/ptx/examples/latex/Makefile create mode 100644 gnu/usr.bin/ptx/examples/latex/README create mode 100644 gnu/usr.bin/ptx/examples/latex/latex.tex create mode 100644 gnu/usr.bin/ptx/examples/latex/table.tex create mode 100644 gnu/usr.bin/ptx/examples/luke/README create mode 100644 gnu/usr.bin/ptx/examples/luke/xxroff.sh create mode 100644 gnu/usr.bin/ptx/getopt.c create mode 100644 gnu/usr.bin/ptx/getopt.h create mode 100644 gnu/usr.bin/ptx/getopt1.c create mode 100755 gnu/usr.bin/ptx/mkinstalldirs create mode 100644 gnu/usr.bin/ptx/ptx.c create mode 100644 gnu/usr.bin/ptx/ptx.info create mode 100644 gnu/usr.bin/ptx/ptx.texinfo create mode 100644 gnu/usr.bin/ptx/regex.h create mode 100644 gnu/usr.bin/ptx/texinfo.tex create mode 100644 gnu/usr.bin/ptx/xmalloc.c create mode 100644 include/octype.h rename usr.bin/vi/include/ndbm.h => include/rune.h (67%) rename usr.bin/vi/include/glob.h => include/runetype.h (50%) create mode 100644 include/skey.h create mode 100644 lib/csu.i386/c++rt0.c delete mode 100644 lib/csu.i386/crt1.c rename lib/libc/{gen => compat-43}/setrgid.c (80%) rename lib/libc/{gen => compat-43}/setruid.c (80%) create mode 100644 lib/libc/locale/ansi.c create mode 100644 lib/libc/locale/euc.4 create mode 100644 lib/libc/locale/euc.c rename usr.bin/vi/nex/ex_cd.c => lib/libc/locale/frune.c (61%) rename lib/libc/{gen => locale}/isctype.c (68%) create mode 100644 lib/libc/locale/mbrune.3 create mode 100644 lib/libc/locale/mbrune.c create mode 100644 lib/libc/locale/multibyte.3 rename usr.bin/vi/nex/ex_util.c => lib/libc/locale/none.c (64%) create mode 100644 lib/libc/locale/rune.3 create mode 100644 lib/libc/locale/rune.c create mode 100644 lib/libc/locale/setlocale.3 create mode 100644 lib/libc/locale/table.c create mode 100644 lib/libc/locale/utf2.4 create mode 100644 lib/libc/locale/utf2.c rename lib/libc/stdio/{fgetline.3 => fgetln.3} (79%) create mode 100644 lib/libc/stdio/fgetln.c rename lib/libc/{gen/setuid.3 => sys/setuid.2} (71%) create mode 100644 lib/libcompat/Makefile create mode 100644 lib/libcompat/cftime.c create mode 100644 lib/libcompat/ftime.c create mode 100644 lib/libcompat/libcompat.3 create mode 100644 lib/libcompat/regex.c create mode 100644 lib/libcompat/regexp/COPYRIGHT create mode 100644 lib/libcompat/regexp/Makefile.inc create mode 100644 lib/libcompat/regexp/README create mode 100644 lib/libcompat/regexp/regerror.c create mode 100644 lib/libcompat/regexp/regexp.3 create mode 100644 lib/libcompat/regexp/regexp.c create mode 100644 lib/libcompat/regexp/regexp.h create mode 100644 lib/libcompat/regexp/regmagic.h create mode 100644 lib/libcompat/regexp/regsub.c create mode 100644 lib/libcompat/setrgid.c create mode 100644 lib/libcompat/setruid.c create mode 100644 lib/libcompat/sgtty.c create mode 100644 lib/libmalloc/CHANGES create mode 100644 lib/libmalloc/COPYRIGHT create mode 100644 lib/libmalloc/Makefile create mode 100644 lib/libmalloc/Makefile.moraes create mode 100644 lib/libmalloc/NOTE create mode 100644 lib/libmalloc/README create mode 100644 lib/libmalloc/TODO create mode 100644 lib/libmalloc/_emalloc.c create mode 100644 lib/libmalloc/_malloc.c create mode 100644 lib/libmalloc/_memalign.c create mode 100644 lib/libmalloc/_strdup.c create mode 100644 lib/libmalloc/_strsave.c create mode 100644 lib/libmalloc/align.h create mode 100644 lib/libmalloc/assert.h create mode 100644 lib/libmalloc/botch.c create mode 100644 lib/libmalloc/bsd.lib.mk create mode 100644 lib/libmalloc/defs.h create mode 100644 lib/libmalloc/dumpheap.c create mode 100644 lib/libmalloc/emalloc.c create mode 100644 lib/libmalloc/externs.h create mode 100644 lib/libmalloc/getmem.c create mode 100644 lib/libmalloc/globals.c create mode 100644 lib/libmalloc/globals.h create mode 100644 lib/libmalloc/globrename.h create mode 100644 lib/libmalloc/leak.c create mode 100644 lib/libmalloc/malloc.c create mode 100644 lib/libmalloc/malloc.doc create mode 100644 lib/libmalloc/malloc.h create mode 100644 lib/libmalloc/memalign.c create mode 100644 lib/libmalloc/setopts.c create mode 100644 lib/libmalloc/sptree.c create mode 100644 lib/libmalloc/sptree.h create mode 100644 lib/libmalloc/stats.c create mode 100644 lib/libmalloc/strdup.c create mode 100644 lib/libmalloc/strsave.c create mode 100755 lib/libmalloc/tests/munge.sh create mode 100755 lib/libmalloc/tests/plot.sh create mode 100755 lib/libmalloc/tests/regress create mode 100644 lib/libmalloc/tests/simumalloc.c create mode 100644 lib/libmalloc/tests/t1.c create mode 100644 lib/libmalloc/tests/t2.c create mode 100644 lib/libmalloc/tests/t3.c create mode 100644 lib/libmalloc/tests/t4.c create mode 100644 lib/libmalloc/tests/t5.c create mode 100644 lib/libmalloc/tests/test.out create mode 100644 lib/libmalloc/tests/testmalloc.c create mode 100644 lib/libmalloc/tests/testmemalign.c create mode 100755 lib/libmalloc/tests/testrun.sh create mode 100644 lib/libmalloc/tests/testsbrk.c create mode 100644 lib/libmalloc/tests/teststomp.c create mode 100644 lib/libmalloc/trace.h create mode 100644 lib/libmalloc/verify.c create mode 100644 lib/libmalloc/version.c create mode 100644 lib/libskey/Makefile create mode 100644 lib/libskey/authfile.c create mode 100644 lib/libskey/md4.c create mode 100644 lib/libskey/md4.h create mode 100644 lib/libskey/pathnames.h create mode 100644 lib/libskey/put.c create mode 100644 lib/libskey/skey_crypt.c create mode 100644 lib/libskey/skeylogin.c create mode 100644 lib/libskey/skeysubr.c create mode 100644 lib/msun/Makefile rename usr.sbin/flcopy/pathnames.h => lib/msun/i387/DEFS.h (60%) create mode 100644 lib/msun/i387/e_acos.S create mode 100644 lib/msun/i387/e_asin.S create mode 100644 lib/msun/i387/e_atan2.S create mode 100644 lib/msun/i387/e_exp.S create mode 100644 lib/msun/i387/e_fmod.S create mode 100644 lib/msun/i387/e_log.S create mode 100644 lib/msun/i387/e_log10.S create mode 100644 lib/msun/i387/e_remainder.S create mode 100644 lib/msun/i387/e_scalb.S create mode 100644 lib/msun/i387/e_sqrt.S create mode 100644 lib/msun/i387/s_atan.S create mode 100644 lib/msun/i387/s_ceil.S create mode 100644 lib/msun/i387/s_copysign.S create mode 100644 lib/msun/i387/s_cos.S create mode 100644 lib/msun/i387/s_finite.S create mode 100644 lib/msun/i387/s_floor.S create mode 100644 lib/msun/i387/s_ilogb.S create mode 100644 lib/msun/i387/s_log1p.S create mode 100644 lib/msun/i387/s_logb.S create mode 100644 lib/msun/i387/s_rint.S create mode 100644 lib/msun/i387/s_scalbn.S create mode 100644 lib/msun/i387/s_significand.S create mode 100644 lib/msun/i387/s_sin.S create mode 100644 lib/msun/i387/s_tan.S rename usr.sbin/flcopy/flcopy.8 => lib/msun/man/acos.3 (62%) create mode 100644 lib/msun/man/acosh.3 create mode 100644 lib/msun/man/asin.3 create mode 100644 lib/msun/man/asinh.3 create mode 100644 lib/msun/man/atan.3 create mode 100644 lib/msun/man/atan2.3 create mode 100644 lib/msun/man/atanh.3 create mode 100644 lib/msun/man/ceil.3 create mode 100644 lib/msun/man/cos.3 create mode 100644 lib/msun/man/cosh.3 create mode 100644 lib/msun/man/erf.3 create mode 100644 lib/msun/man/exp.3 create mode 100644 lib/msun/man/fabs.3 create mode 100644 lib/msun/man/floor.3 create mode 100644 lib/msun/man/fmod.3 create mode 100644 lib/msun/man/hypot.3 create mode 100644 lib/msun/man/ieee.3 create mode 100644 lib/msun/man/ieee_test.3 create mode 100644 lib/msun/man/j0.3 create mode 100644 lib/msun/man/lgamma.3 create mode 100644 lib/msun/man/math.3 create mode 100644 lib/msun/man/rint.3 create mode 100644 lib/msun/man/sin.3 create mode 100644 lib/msun/man/sinh.3 create mode 100644 lib/msun/man/sqrt.3 create mode 100644 lib/msun/man/tan.3 create mode 100644 lib/msun/man/tanh.3 create mode 100644 lib/msun/src/Readme create mode 100644 lib/msun/src/dependencies create mode 100644 lib/msun/src/e_acos.c create mode 100644 lib/msun/src/e_acosh.c create mode 100644 lib/msun/src/e_asin.c create mode 100644 lib/msun/src/e_atan2.c create mode 100644 lib/msun/src/e_atanh.c create mode 100644 lib/msun/src/e_cosh.c create mode 100644 lib/msun/src/e_exp.c create mode 100644 lib/msun/src/e_fmod.c create mode 100644 lib/msun/src/e_gamma.c create mode 100644 lib/msun/src/e_gamma_r.c create mode 100644 lib/msun/src/e_hypot.c create mode 100644 lib/msun/src/e_j0.c create mode 100644 lib/msun/src/e_j1.c create mode 100644 lib/msun/src/e_jn.c create mode 100644 lib/msun/src/e_lgamma.c create mode 100644 lib/msun/src/e_lgamma_r.c create mode 100644 lib/msun/src/e_log.c create mode 100644 lib/msun/src/e_log10.c create mode 100644 lib/msun/src/e_pow.c create mode 100644 lib/msun/src/e_rem_pio2.c create mode 100644 lib/msun/src/e_remainder.c create mode 100644 lib/msun/src/e_scalb.c create mode 100644 lib/msun/src/e_sinh.c create mode 100644 lib/msun/src/e_sqrt.c create mode 100644 lib/msun/src/fdlibm.h create mode 100644 lib/msun/src/k_cos.c create mode 100644 lib/msun/src/k_rem_pio2.c create mode 100644 lib/msun/src/k_sin.c create mode 100644 lib/msun/src/k_standard.c create mode 100644 lib/msun/src/k_tan.c create mode 100644 lib/msun/src/math.h create mode 100644 lib/msun/src/s_asinh.c create mode 100644 lib/msun/src/s_atan.c create mode 100644 lib/msun/src/s_cbrt.c create mode 100644 lib/msun/src/s_ceil.c create mode 100644 lib/msun/src/s_copysign.c create mode 100644 lib/msun/src/s_cos.c create mode 100644 lib/msun/src/s_erf.c create mode 100644 lib/msun/src/s_expm1.c create mode 100644 lib/msun/src/s_fabs.c create mode 100644 lib/msun/src/s_finite.c create mode 100644 lib/msun/src/s_floor.c create mode 100644 lib/msun/src/s_frexp.c create mode 100644 lib/msun/src/s_ilogb.c create mode 100644 lib/msun/src/s_isnan.c create mode 100644 lib/msun/src/s_ldexp.c create mode 100644 lib/msun/src/s_lib_version.c create mode 100644 lib/msun/src/s_log1p.c create mode 100644 lib/msun/src/s_logb.c create mode 100644 lib/msun/src/s_matherr.c create mode 100644 lib/msun/src/s_modf.c create mode 100644 lib/msun/src/s_nextafter.c create mode 100644 lib/msun/src/s_rint.c create mode 100644 lib/msun/src/s_scalbn.c create mode 100644 lib/msun/src/s_signgam.c create mode 100644 lib/msun/src/s_significand.c create mode 100644 lib/msun/src/s_sin.c create mode 100644 lib/msun/src/s_tan.c create mode 100644 lib/msun/src/s_tanh.c create mode 100644 lib/msun/src/w_acos.c create mode 100644 lib/msun/src/w_acosh.c create mode 100644 lib/msun/src/w_asin.c create mode 100644 lib/msun/src/w_atan2.c create mode 100644 lib/msun/src/w_atanh.c create mode 100644 lib/msun/src/w_cabs.c create mode 100644 lib/msun/src/w_cosh.c create mode 100644 lib/msun/src/w_drem.c create mode 100644 lib/msun/src/w_exp.c create mode 100644 lib/msun/src/w_fmod.c create mode 100644 lib/msun/src/w_gamma.c create mode 100644 lib/msun/src/w_gamma_r.c create mode 100644 lib/msun/src/w_hypot.c create mode 100644 lib/msun/src/w_j0.c create mode 100644 lib/msun/src/w_j1.c create mode 100644 lib/msun/src/w_jn.c create mode 100644 lib/msun/src/w_lgamma.c create mode 100644 lib/msun/src/w_lgamma_r.c create mode 100644 lib/msun/src/w_log.c create mode 100644 lib/msun/src/w_log10.c create mode 100644 lib/msun/src/w_pow.c create mode 100644 lib/msun/src/w_remainder.c create mode 100644 lib/msun/src/w_scalb.c create mode 100644 lib/msun/src/w_sinh.c create mode 100644 lib/msun/src/w_sqrt.c create mode 100644 libexec/ftpd/skey-stuff.c create mode 100644 libexec/pppd/README create mode 100644 libexec/pppd/auth.c create mode 100644 libexec/pppd/options.c rename {sys/net => libexec/pppd}/ppp.h (89%) create mode 100644 libexec/pppd/sys-bsd.c create mode 100644 libexec/pppd/sys-str.c create mode 100644 libexec/xtend/Makefile create mode 100644 libexec/xtend/packet.c create mode 100644 libexec/xtend/paths.h create mode 100644 libexec/xtend/status.c create mode 100644 libexec/xtend/user.c create mode 100644 libexec/xtend/xten.h create mode 100644 libexec/xtend/xtend.8 create mode 100644 libexec/xtend/xtend.c create mode 100644 libexec/xtend/xtend.h create mode 100644 sbin/init/init.o create mode 100644 sbin/md5/Makefile create mode 100644 sbin/md5/README create mode 100644 sbin/md5/global.h create mode 100644 sbin/md5/md5-announcement.txt create mode 100644 sbin/md5/md5.1 create mode 100644 sbin/md5/md5.h create mode 100644 sbin/md5/md5c.c create mode 100644 sbin/md5/mddriver.c create mode 100644 share/locale/Ja_JP.EUC create mode 100644 share/locale/Makefile create mode 100644 share/locale/POSIX create mode 100644 share/locale/Russian.koi8-r rename usr.bin/vi/nvi/v_exmode.c => share/locale/ldef.h (80%) create mode 100644 share/locale/lex.l create mode 100644 share/locale/mklocale.1 create mode 100644 share/locale/yacc.y delete mode 100644 share/man/man4/man4.i386/lpa.4 create mode 100644 share/man/man4/man4.i386/tw.4 create mode 100644 share/man/man5/skey.access.5 create mode 100644 share/man/man7/mdoc.7 create mode 100644 share/syscons/fonts/alt-8x14.fnt create mode 100644 share/syscons/fonts/alt-8x16.fnt create mode 100644 share/syscons/fonts/alt-8x8.fnt rename share/syscons/fonts/{alt8x16.fnt => altb-8x16} (100%) create mode 100644 share/syscons/fonts/altb-8x16.fnt create mode 100644 share/syscons/fonts/altc-8x16.fnt create mode 100644 share/syscons/fonts/cp850-8x14.fnt create mode 100644 share/syscons/fonts/cp850-8x16.fnt create mode 100644 share/syscons/fonts/cp850-8x8.fnt create mode 100644 share/syscons/fonts/cp865-8x14.fnt create mode 100644 share/syscons/fonts/cp865-8x16.fnt create mode 100644 share/syscons/fonts/cp865-8x8.fnt create mode 100644 share/syscons/fonts/iso-8x14.fnt create mode 100644 share/syscons/fonts/iso-8x16.fnt create mode 100644 share/syscons/fonts/iso-8x8.fnt create mode 100644 share/syscons/fonts/koi8-8x14.fnt create mode 100644 share/syscons/fonts/koi8-8x16.fnt create mode 100644 share/syscons/fonts/koi8-8x8.fnt create mode 100644 share/syscons/fonts/koi8b-8x16 create mode 100644 share/syscons/fonts/koi8b-8x16.fnt create mode 100644 share/syscons/fonts/koi8c-8x16.fnt create mode 100644 share/syscons/keymaps/danish.cp865.kbd create mode 100644 share/syscons/keymaps/danish.iso.kbd create mode 100644 share/syscons/keymaps/german.cp850.kbd create mode 100644 share/syscons/keymaps/german.iso.kbd create mode 100644 share/syscons/keymaps/ru.koi8-r.kbd create mode 100644 share/syscons/keymaps/swedish.cp850.kbd create mode 100644 share/syscons/keymaps/swedish.iso.kbd create mode 100644 share/syscons/keymaps/uk.cp850.kbd create mode 100644 share/syscons/keymaps/uk.iso.kbd create mode 100644 share/syscons/keymaps/us.iso.kbd create mode 100644 share/syscons/scrnmaps/koi8-r2alt.scm rename sys/{i386 => }/doc/Changes (69%) rename sys/{i386 => }/doc/Makefile (89%) rename sys/{i386 => }/doc/ata/ata-1 (100%) rename sys/{i386 => }/doc/ata/ata-10 (100%) rename sys/{i386 => }/doc/ata/ata-11 (100%) rename sys/{i386 => }/doc/ata/ata-2 (100%) rename sys/{i386 => }/doc/ata/ata-3 (100%) rename sys/{i386 => }/doc/ata/ata-4 (100%) rename sys/{i386 => }/doc/ata/ata-5 (100%) rename sys/{i386 => }/doc/ata/ata-6 (100%) rename sys/{i386 => }/doc/ata/ata-7 (100%) rename sys/{i386 => }/doc/ata/ata-8 (100%) rename sys/{i386 => }/doc/ata/ata-9 (100%) rename sys/{i386 => }/doc/ata/ata-apx (100%) rename sys/{i386 => }/doc/ata/ata-prt (100%) rename sys/{i386 => }/doc/ata/ata-toc (100%) rename sys/{i386 => }/doc/ed.relnotes (99%) create mode 100644 sys/doc/memory-test.doc create mode 100644 sys/doc/options.doc rename sys/{i386 => }/doc/options.texi (81%) create mode 100644 sys/doc/seagate.doc create mode 100644 sys/doc/sound.doc rename sys/{i386 => }/doc/vm_layout.doc (93%) rename sys/{i386 => }/doc/wt.doc (100%) create mode 100644 sys/gnu/fpemul/Changelog create mode 100644 sys/gnu/fpemul/README create mode 100644 sys/gnu/fpemul/control_w.h create mode 100644 sys/gnu/fpemul/div_small.s create mode 100644 sys/gnu/fpemul/errors.c create mode 100644 sys/gnu/fpemul/exception.h create mode 100644 sys/gnu/fpemul/fpu_arith.c create mode 100644 sys/gnu/fpemul/fpu_asm.h create mode 100644 sys/gnu/fpemul/fpu_aux.c create mode 100644 sys/gnu/fpemul/fpu_emu.h create mode 100644 sys/gnu/fpemul/fpu_entry.c create mode 100644 sys/gnu/fpemul/fpu_etc.c create mode 100644 sys/gnu/fpemul/fpu_proto.h create mode 100644 sys/gnu/fpemul/fpu_system.h create mode 100644 sys/gnu/fpemul/fpu_trig.c create mode 100644 sys/gnu/fpemul/get_address.c create mode 100644 sys/gnu/fpemul/load_store.c create mode 100644 sys/gnu/fpemul/math_emu.h create mode 100644 sys/gnu/fpemul/poly_2xm1.c create mode 100644 sys/gnu/fpemul/poly_atan.c create mode 100644 sys/gnu/fpemul/poly_div.s create mode 100644 sys/gnu/fpemul/poly_l2.c create mode 100644 sys/gnu/fpemul/poly_mul64.s create mode 100644 sys/gnu/fpemul/poly_sin.c create mode 100644 sys/gnu/fpemul/poly_tan.c create mode 100644 sys/gnu/fpemul/polynomial.s create mode 100644 sys/gnu/fpemul/reg_add_sub.c create mode 100644 sys/gnu/fpemul/reg_compare.c create mode 100644 sys/gnu/fpemul/reg_constant.c create mode 100644 sys/gnu/fpemul/reg_constant.h create mode 100644 sys/gnu/fpemul/reg_div.s create mode 100644 sys/gnu/fpemul/reg_ld_str.c create mode 100644 sys/gnu/fpemul/reg_mul.c create mode 100644 sys/gnu/fpemul/reg_norm.s create mode 100644 sys/gnu/fpemul/reg_round.s create mode 100644 sys/gnu/fpemul/reg_u_add.s create mode 100644 sys/gnu/fpemul/reg_u_div.s create mode 100644 sys/gnu/fpemul/reg_u_mul.s create mode 100644 sys/gnu/fpemul/reg_u_sub.s create mode 100644 sys/gnu/fpemul/status_w.h create mode 100644 sys/gnu/fpemul/version.h create mode 100644 sys/gnu/fpemul/wm_shrx.s create mode 100644 sys/gnu/fpemul/wm_sqrt.s create mode 100644 sys/i386/boot/biosboot create mode 100644 sys/i386/boot/boot create mode 100755 sys/i386/boot/boot.sym create mode 100644 sys/i386/boot/bootbios create mode 100644 sys/i386/conf/ECLIPSE create mode 100644 sys/i386/conf/HAMSTER create mode 100644 sys/i386/conf/LAPTOP delete mode 100644 sys/i386/conf/SYSCONS create mode 100644 sys/i386/conf/TIME create mode 100644 sys/i386/conf/WCARCH create mode 100644 sys/i386/conf/WCARCHIVE delete mode 100644 sys/i386/doc/sound.doc create mode 100644 sys/i386/i386/random.s create mode 100644 sys/i386/include/lpt.h create mode 100644 sys/i386/include/mouse.h create mode 100644 sys/i386/include/pcaudioio.h create mode 100644 sys/i386/include/spl.h create mode 100644 sys/i386/isa/bt742a_32.c delete mode 100644 sys/i386/isa/debug.h create mode 100644 sys/i386/isa/elink.c create mode 100644 sys/i386/isa/elink.h create mode 100644 sys/i386/isa/ic/i82365.h create mode 100644 sys/i386/isa/if_el.c create mode 100644 sys/i386/isa/if_elreg.h create mode 100644 sys/i386/isa/if_ie507.h create mode 100644 sys/i386/isa/if_ze.c create mode 100644 sys/i386/isa/if_zereg.h create mode 100644 sys/i386/isa/ipl.h create mode 100644 sys/i386/isa/pcaudio.c create mode 100644 sys/i386/isa/psm.c create mode 100644 sys/i386/isa/seagate.c create mode 100644 sys/i386/isa/sound/CHANGELOG delete mode 100644 sys/i386/isa/sound/debug.h delete mode 100644 sys/i386/isa/sound/dsp.c create mode 100644 sys/i386/isa/sound/gus_linearvol.h create mode 100644 sys/i386/isa/sound/ics2101.c create mode 100644 sys/i386/isa/sound/sb.h create mode 100644 sys/i386/isa/sound/sb16_dsp.c create mode 100644 sys/i386/isa/sound/sb16_midi.c create mode 100644 sys/i386/isa/sound/sb_midi.c create mode 100644 sys/i386/isa/sound/sb_mixer.c create mode 100644 sys/i386/isa/sound/sb_mixer.h create mode 100644 sys/i386/isa/sound/sound_switch.c create mode 100644 sys/i386/isa/tw.c create mode 100644 sys/i386/isa/wt.c.orig create mode 100644 sys/i386/netboot/ether.c create mode 100644 sys/i386/netboot/ether.h delete mode 100644 sys/i386/netboot/wd80x3.c create mode 100644 sys/i386/pci/ncr.c create mode 100644 sys/i386/pci/ncr_reg.h create mode 100644 sys/i386/pci/pci.c create mode 100644 sys/i386/pci/pci.h create mode 100644 sys/i386/pci/pci_config.c create mode 100644 sys/i386/pci/pci_device.h create mode 100644 sys/i386/pci/pcibios.c create mode 100644 sys/i386/pci/pcibios.h create mode 100644 sys/kern/kern_ntptime.c create mode 100644 sys/kern/subr_rand.c create mode 100644 sys/net/pppdefs.h create mode 100644 sys/netinet/igmp.c rename lib/libc/stdlib/multibyte.c => sys/netinet/igmp.h (63%) create mode 100644 sys/netinet/igmp_var.h create mode 100644 sys/netinet/in_pcb.old.c create mode 100644 sys/netinet/in_pcb.orig.c create mode 100644 sys/netinet/ip_mroute.c create mode 100644 sys/netinet/ip_mroute.h create mode 100644 sys/sys/timex.h create mode 100644 usr.bin/cap_mkdb/Makefile create mode 100644 usr.bin/cap_mkdb/cap_mkdb.1 create mode 100644 usr.bin/cap_mkdb/cap_mkdb.c create mode 100644 usr.bin/key/Makefile create mode 100644 usr.bin/key/README.WZV create mode 100644 usr.bin/key/key.1 create mode 100644 usr.bin/key/skey.1 create mode 100644 usr.bin/key/skey.c create mode 100644 usr.bin/keyinfo/Makefile create mode 100644 usr.bin/keyinfo/keyinfo.1 create mode 100644 usr.bin/keyinfo/keyinfo.sh create mode 100644 usr.bin/keyinit/Makefile create mode 100644 usr.bin/keyinit/keyinit.1 create mode 100644 usr.bin/keyinit/skeyinit.c create mode 100644 usr.bin/login/README create mode 100644 usr.bin/login/login.access.5 create mode 100644 usr.bin/login/login_access.c create mode 100644 usr.bin/login/login_skey.c create mode 100644 usr.bin/netstat/mroute.c rename games/hack/pathnames.h => usr.bin/passwd/kpasswd_proto.h (76%) create mode 100644 usr.bin/passwd/krb_passwd.c create mode 100644 usr.bin/passwd/pw_fastmkdb.c create mode 100644 usr.bin/rlogin/kcmd.c create mode 100644 usr.bin/rlogin/krcmd.c delete mode 100644 usr.bin/syscons/Makefile delete mode 100644 usr.bin/syscons/syscons.1 delete mode 100644 usr.bin/syscons/syscons.c create mode 100644 usr.bin/vi/compat.h create mode 100644 usr.bin/vi/docs/README create mode 100644 usr.bin/vi/docs/USD.doc/edit/Makefile create mode 100644 usr.bin/vi/docs/USD.doc/edit/edit.vindex create mode 100644 usr.bin/vi/docs/USD.doc/edit/edittut.ms create mode 100644 usr.bin/vi/docs/USD.doc/ex/Makefile create mode 100644 usr.bin/vi/docs/USD.doc/ex/ex.rm create mode 100644 usr.bin/vi/docs/USD.doc/ex/ex.summary create mode 100644 usr.bin/vi/docs/USD.doc/vi/Makefile create mode 100644 usr.bin/vi/docs/USD.doc/vi/vi.apwh.ms create mode 100644 usr.bin/vi/docs/USD.doc/vi/vi.chars create mode 100644 usr.bin/vi/docs/USD.doc/vi/vi.in create mode 100644 usr.bin/vi/docs/USD.doc/vi/vi.summary create mode 100644 usr.bin/vi/docs/bugs.current create mode 100644 usr.bin/vi/docs/changelog create mode 100644 usr.bin/vi/docs/features create mode 100644 usr.bin/vi/docs/internals/autowrite create mode 100644 usr.bin/vi/docs/internals/gdb.script create mode 100644 usr.bin/vi/docs/internals/input create mode 100644 usr.bin/vi/docs/internals/quoting create mode 100644 usr.bin/vi/docs/internals/structures create mode 100644 usr.bin/vi/docs/set.opt.roff create mode 100644 usr.bin/vi/docs/spell.ok create mode 100644 usr.bin/vi/docs/tutorial/vi.advanced create mode 100644 usr.bin/vi/docs/tutorial/vi.beginner create mode 100644 usr.bin/vi/docs/tutorial/vi.tut.csh rename usr.bin/vi/{ => docs}/vi.1 (99%) create mode 100644 usr.bin/vi/docs/vi.ref create mode 100644 usr.bin/vi/docs/vi.ref.txt rename usr.bin/vi/{nex => ex}/ex.c (89%) rename usr.bin/vi/{nex => ex}/ex_abbrev.c (89%) rename usr.bin/vi/{nex => ex}/ex_append.c (89%) rename usr.bin/vi/{nex => ex}/ex_args.c (95%) rename usr.bin/vi/{nex => ex}/ex_argv.c (94%) rename usr.bin/vi/{nex => ex}/ex_at.c (91%) rename usr.bin/vi/{nex => ex}/ex_bang.c (95%) create mode 100644 usr.bin/vi/ex/ex_cd.c rename usr.bin/vi/{nex => ex}/ex_delete.c (90%) rename usr.bin/vi/{nex => ex}/ex_digraph.c (96%) rename usr.bin/vi/{nex => ex}/ex_display.c (93%) rename usr.bin/vi/{nex => ex}/ex_edit.c (92%) rename usr.bin/vi/{nex => ex}/ex_equal.c (89%) rename usr.bin/vi/{nex => ex}/ex_exit.c (90%) rename usr.bin/vi/{nex => ex}/ex_file.c (91%) rename usr.bin/vi/{nex => ex}/ex_global.c (91%) rename usr.bin/vi/{nex => ex}/ex_init.c (90%) rename usr.bin/vi/{nex => ex}/ex_join.c (92%) rename usr.bin/vi/{nex => ex}/ex_map.c (92%) rename usr.bin/vi/{nex => ex}/ex_mark.c (88%) rename usr.bin/vi/{nex => ex}/ex_mkexrc.c (91%) create mode 100644 usr.bin/vi/ex/ex_move.c rename usr.bin/vi/{nex => ex}/ex_open.c (89%) rename usr.bin/vi/{nex => ex}/ex_preserve.c (90%) rename usr.bin/vi/{nex => ex}/ex_print.c (94%) rename usr.bin/vi/{nex => ex}/ex_put.c (89%) rename usr.bin/vi/{nex => ex}/ex_read.c (85%) rename usr.bin/vi/{nex => ex}/ex_screen.c (84%) rename usr.bin/vi/{nex => ex}/ex_script.c (97%) rename usr.bin/vi/{nex => ex}/ex_set.c (88%) rename usr.bin/vi/{nex => ex}/ex_shell.c (84%) rename usr.bin/vi/{nex => ex}/ex_shift.c (95%) rename usr.bin/vi/{nex => ex}/ex_source.c (88%) rename usr.bin/vi/{nex => ex}/ex_stop.c (90%) rename usr.bin/vi/{nex => ex}/ex_subst.c (94%) rename usr.bin/vi/{nex => ex}/ex_tag.c (84%) rename usr.bin/vi/{nex => ex}/ex_undo.c (90%) rename usr.bin/vi/{nex => ex}/ex_usage.c (88%) create mode 100644 usr.bin/vi/ex/ex_util.c rename usr.bin/vi/{nex => ex}/ex_version.c (84%) rename usr.bin/vi/{nex => ex}/ex_visual.c (92%) rename usr.bin/vi/{nex => ex}/ex_write.c (87%) rename usr.bin/vi/{nex => ex}/ex_yank.c (88%) rename usr.bin/vi/{nex => ex}/ex_z.c (94%) rename usr.bin/vi/{nex => ex}/excmd.c (92%) rename usr.bin/vi/{nex => ex}/excmd.h.stub (60%) rename usr.bin/vi/{nex => ex}/filter.c (96%) rename usr.bin/vi/{nex => ex}/script.h (100%) rename usr.bin/vi/{nex => ex}/tag.h (100%) delete mode 100644 usr.bin/vi/include/bitstring.h delete mode 100644 usr.bin/vi/include/cdefs.h delete mode 100644 usr.bin/vi/include/compat.h delete mode 100644 usr.bin/vi/include/err.h delete mode 100644 usr.bin/vi/include/file.h delete mode 100644 usr.bin/vi/include/mpool.h delete mode 100644 usr.bin/vi/include/queue.h delete mode 100644 usr.bin/vi/interrupt.h create mode 100644 usr.bin/vi/intr.c delete mode 100644 usr.bin/vi/nex/ex_move.c delete mode 100644 usr.bin/vi/nvi/v_section.c delete mode 100644 usr.bin/vi/nvi/v_word.c delete mode 100644 usr.bin/vi/nvi/v_yank.c delete mode 100644 usr.bin/vi/nvi/vcmd.h create mode 100644 usr.bin/vi/put.c rename usr.bin/vi/{nvi => vi}/getc.c (93%) rename usr.bin/vi/{nvi => vi}/v_again.c (83%) rename usr.bin/vi/{nvi => vi}/v_at.c (84%) rename usr.bin/vi/{nvi => vi}/v_ch.c (54%) rename usr.bin/vi/{nvi => vi}/v_delete.c (59%) rename usr.bin/vi/{nvi => vi}/v_ex.c (75%) rename usr.bin/vi/{nvi => vi}/v_filter.c (87%) rename usr.bin/vi/{nvi => vi}/v_increment.c (86%) rename usr.bin/vi/{nvi => vi}/v_init.c (93%) rename usr.bin/vi/{nvi => vi}/v_join.c (83%) create mode 100644 usr.bin/vi/vi/v_left.c rename usr.bin/vi/{nvi/v_left.c => vi/v_mark.c} (50%) rename usr.bin/vi/{nvi => vi}/v_match.c (62%) rename usr.bin/vi/{nvi => vi}/v_ntext.c (87%) rename usr.bin/vi/{nvi => vi}/v_paragraph.c (54%) rename usr.bin/vi/{nvi => vi}/v_put.c (86%) rename usr.bin/vi/{nvi => vi}/v_redraw.c (86%) rename usr.bin/vi/{nvi => vi}/v_replace.c (67%) rename usr.bin/vi/{nvi => vi}/v_right.c (58%) rename usr.bin/vi/{nvi => vi}/v_screen.c (87%) rename usr.bin/vi/{nvi => vi}/v_scroll.c (64%) rename usr.bin/vi/{nvi => vi}/v_search.c (59%) create mode 100644 usr.bin/vi/vi/v_section.c rename usr.bin/vi/{nvi => vi}/v_sentence.c (65%) rename usr.bin/vi/{nvi => vi}/v_shift.c (79%) rename usr.bin/vi/{nvi => vi}/v_status.c (91%) rename usr.bin/vi/{nvi => vi}/v_stop.c (87%) rename usr.bin/vi/{nvi => vi}/v_switch.c (88%) rename usr.bin/vi/{nvi => vi}/v_tag.c (84%) rename usr.bin/vi/{nvi => vi}/v_text.c (71%) rename usr.bin/vi/{nvi => vi}/v_ulcase.c (74%) rename usr.bin/vi/{nvi => vi}/v_undo.c (91%) rename usr.bin/vi/{nvi => vi}/v_util.c (85%) create mode 100644 usr.bin/vi/vi/v_word.c rename usr.bin/vi/{nvi => vi}/v_xchar.c (60%) rename usr.bin/vi/{nvi/v_mark.c => vi/v_yank.c} (57%) rename usr.bin/vi/{nvi => vi}/v_z.c (87%) rename usr.bin/vi/{nvi/v_exit.c => vi/v_zexit.c} (85%) rename usr.bin/vi/{nvi => vi}/vcmd.c (71%) create mode 100644 usr.bin/vi/vi/vcmd.h rename usr.bin/vi/{nvi => vi}/vi.c (72%) rename {sbin => usr.sbin}/XNSrouted/Makefile (100%) rename {sbin => usr.sbin}/XNSrouted/XNSrouted.8 (100%) rename {sbin => usr.sbin}/XNSrouted/af.c (100%) rename {sbin => usr.sbin}/XNSrouted/af.h (100%) rename {sbin => usr.sbin}/XNSrouted/defs.h (100%) rename {sbin => usr.sbin}/XNSrouted/if.c (100%) rename {sbin => usr.sbin}/XNSrouted/input.c (100%) rename {sbin => usr.sbin}/XNSrouted/interface.h (100%) rename {sbin => usr.sbin}/XNSrouted/main.c (100%) rename {sbin => usr.sbin}/XNSrouted/output.c (100%) rename {sbin => usr.sbin}/XNSrouted/protocol.h (100%) rename {sbin => usr.sbin}/XNSrouted/startup.c (100%) rename {sbin => usr.sbin}/XNSrouted/table.h (100%) rename {sbin => usr.sbin}/XNSrouted/tables.c (100%) rename {sbin => usr.sbin}/XNSrouted/timer.c (100%) rename {sbin => usr.sbin}/XNSrouted/tools/query.c (100%) rename {sbin => usr.sbin}/XNSrouted/trace.c (100%) rename {sbin => usr.sbin}/XNSrouted/trace.h (100%) create mode 100644 usr.sbin/ac/Makefile create mode 100644 usr.sbin/ac/ac.8 create mode 100644 usr.sbin/ac/ac.c create mode 100644 usr.sbin/fdcontrol/Makefile create mode 100644 usr.sbin/fdcontrol/fdcontrol.8 create mode 100644 usr.sbin/fdcontrol/fdcontrol.c delete mode 100644 usr.sbin/flcopy/Makefile delete mode 100644 usr.sbin/flcopy/flcopy.c create mode 100644 usr.sbin/kbdcontrol/Makefile create mode 100644 usr.sbin/kbdcontrol/kbdcontrol.1 create mode 100644 usr.sbin/kbdcontrol/kbdcontrol.c create mode 100644 usr.sbin/kbdcontrol/lex.h create mode 100644 usr.sbin/kbdcontrol/lex.l rename usr.bin/syscons/syscons.h => usr.sbin/kbdcontrol/path.h (67%) create mode 100644 usr.sbin/lptcontrol/Makefile create mode 100644 usr.sbin/lptcontrol/lptcontrol.1 create mode 100644 usr.sbin/lptcontrol/lptcontrol.c create mode 100644 usr.sbin/mrouted/LICENSE create mode 100644 usr.sbin/mrouted/Makefile create mode 100644 usr.sbin/mrouted/config.c create mode 100644 usr.sbin/mrouted/defs.h create mode 100644 usr.sbin/mrouted/dvmrp.h create mode 100644 usr.sbin/mrouted/igmp.c create mode 100644 usr.sbin/mrouted/inet.c create mode 100644 usr.sbin/mrouted/kern.c create mode 100644 usr.sbin/mrouted/main.c create mode 100644 usr.sbin/mrouted/mapper.c create mode 100644 usr.sbin/mrouted/mrinfo.c create mode 100644 usr.sbin/mrouted/mrouted.8 create mode 100644 usr.sbin/mrouted/mrouted.conf create mode 100644 usr.sbin/mrouted/route.c create mode 100644 usr.sbin/mrouted/route.h create mode 100644 usr.sbin/mrouted/vif.c create mode 100644 usr.sbin/mrouted/vif.h rename {sbin => usr.sbin}/routed/Makefile (100%) rename {sbin => usr.sbin}/routed/af.c (100%) rename {sbin => usr.sbin}/routed/af.h (100%) rename {sbin => usr.sbin}/routed/defs.h (100%) rename {sbin => usr.sbin}/routed/if.c (100%) rename {sbin => usr.sbin}/routed/inet.c (100%) rename {sbin => usr.sbin}/routed/input.c (100%) rename {sbin => usr.sbin}/routed/interface.h (98%) rename {sbin => usr.sbin}/routed/main.c (100%) rename {sbin => usr.sbin}/routed/output.c (100%) rename {sbin => usr.sbin}/routed/pathnames.h (100%) rename {sbin => usr.sbin}/routed/query/Makefile (100%) rename {sbin => usr.sbin}/routed/query/query.c (100%) rename {sbin => usr.sbin}/routed/routed.8 (100%) rename {sbin => usr.sbin}/routed/startup.c (99%) rename {sbin => usr.sbin}/routed/table.h (100%) rename {sbin => usr.sbin}/routed/tables.c (100%) rename {sbin => usr.sbin}/routed/timer.c (100%) rename {sbin => usr.sbin}/routed/trace.c (100%) rename {sbin => usr.sbin}/routed/trace.h (100%) rename {sbin => usr.sbin}/routed/trace/Makefile (100%) rename {sbin => usr.sbin}/routed/trace/trace.c (100%) create mode 100644 usr.sbin/sa/Makefile create mode 100644 usr.sbin/sa/extern.h create mode 100644 usr.sbin/sa/main.c create mode 100644 usr.sbin/sa/pathnames.h create mode 100644 usr.sbin/sa/pdb.c create mode 100644 usr.sbin/sa/sa.8 create mode 100644 usr.sbin/sa/usrdb.c create mode 100644 usr.sbin/slstat/Makefile create mode 100644 usr.sbin/slstat/slstat.8 create mode 100644 usr.sbin/slstat/slstat.c create mode 100644 usr.sbin/vidcontrol/Makefile create mode 100644 usr.sbin/vidcontrol/decode.c create mode 100644 usr.sbin/vidcontrol/path.h create mode 100644 usr.sbin/vidcontrol/vidcontrol.1 create mode 100644 usr.sbin/vidcontrol/vidcontrol.c create mode 100644 usr.sbin/xten/Install.notes create mode 100644 usr.sbin/xten/Makefile create mode 100644 usr.sbin/xten/xten.1 create mode 100644 usr.sbin/xten/xten.c diff --git a/CONTRIB.FreeBSD b/CONTRIB.FreeBSD index e06bc96faa63..482fbfdf5b1e 100644 --- a/CONTRIB.FreeBSD +++ b/CONTRIB.FreeBSD @@ -1,20 +1,24 @@ - FreeBSD 1.1 - Contributor List + FreeBSD 1.1.5 + Contributor List Derived Software Contributors: -This software was derived from William F. Jolitz's 386BSD release 0.1. +This software was originally derived from William F. Jolitz's 386BSD +release 0.1, though very little of the original 386BSD specific code +remains. + Please see the file CONTRIB.386BSD for the list of contributors from 386BSD. -Included in this release are the patches from the patch kit version -0.2.4. The names of contributors from the patch kit are listed below. +Included in this release are some of the patches from the old 386BSD +patch kit version 0.2.4, and therefore the names of contributors from the +patch kit are also listed below. -There are portions of NetBSD that has been intergraged into FreeBSD -as well. We would like to thank all the contributors to NetBSD for -their work. +Finally, there are 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. Hardware Contributors: @@ -28,32 +32,35 @@ Dermot McDonnell for his donation of a Toshiba XM3401B CDROM drive. -FreeBSD core: +The FreeBSD Core Team (in alphabetical order): -Andrew Moore -Andreas Schulz +Andrew A. Chernov John Dyson -Christoph Robitschko David Greenman -Jordan K. Hubbard -Nate Williams -Paul Richards -Rich Murphey Rodney W. Grimes +Jordan K. Hubbard Scott Mace +Andrew Moore +Rich Murphey +Geoff Rehmet +Paul Richards +Andreas Schulz +Nate Williams Garrett A. Wollman -Additional FreeBSD Contributors: +Additional FreeBSD Contributors (no particular order): +Atsushi Murai +Keith Moore Adam Glass -Andrew A. Chernov Andrew Herbert Bob Wilcox Bruce Evans Charles Hannum Chris G. Demetriou Chris Torek +Christoph Robitschko Curt Mayer Dave Burgess Dave Rivers @@ -69,7 +76,7 @@ J.T. Conklin James Clark James da Silva et al Jim Wilson -John Dyson - +Joerg Wunsch Julian Elischer Julian Stacey > Keith Bostic @@ -79,7 +86,7 @@ Martin Birgmeier Paul Kranenburg Paul Mackerras Poul-Henning Kamp -Rod Shady +Rob Shady Sascha Wildner Sean Eric Fagan Serge V. Vakulenko @@ -90,7 +97,7 @@ Theo Deraadt Yuval Yarom -Patch kit patch contributors: +Patch kit patch contributors (no particular order): Adam Glass Adrian Hall @@ -138,7 +145,7 @@ Joerg Lohse Joerg Wunsch John Dyson - John Woods -Jordan K. Hubbard +Jordan K. Hubbard Julian Elischer Julian Stacey > Karl Lehenbauer @@ -165,11 +172,10 @@ Rich Murphey Rick Macklem Robert D. Thrush Rodney W. Grimes -Rog Egge +Rog Egge Sascha Wildner Scott Burris Scott Reynolds -Scotty ? Sean Eric Fagan Simon J Gerraty Stephen McKay @@ -182,4 +188,4 @@ Wolfgang Solfrank Wolfgang Stanglmeier Yuval Yarom -$Id: CONTRIB.FreeBSD,v 1.32.2.1 1994/03/07 01:29:59 rgrimes Exp $ +$Id: CONTRIB.FreeBSD,v 1.36 1994/06/28 08:09:27 jkh Exp $ diff --git a/COPYRIGHT.FreeBSD b/COPYRIGHT.FreeBSD index a4d88b1e0fcd..65d1707f4639 100644 --- a/COPYRIGHT.FreeBSD +++ b/COPYRIGHT.FreeBSD @@ -79,9 +79,10 @@ Copyright (C) 1992, 1993, Garrett A. Wollman Copyright (C) 1992, 1993, HD Associates Copyright (C) 1992, 1993, Holger Veit Copyright (C) 1992, 1993, Jean-Loup Gailly -Copyright (C) 1992, 1993, Joerg Wunsch +Copyright (C) 1992, 1993, 1994 Joerg Wunsch Copyright (C) 1992, 1993, John Brezak Copyright (C) 1992, 1993, Motorola, Inc. +Copyright (C) 1993, 1994, Jordan Hubbard Copyright (C) 1992, 1993, Soeren Schmidt Copyright (C) 1992, 1993, Theo de Raadt Copyright (C) 1992, 1993, University of Vermont and State Agricultural College @@ -114,5 +115,8 @@ Copyright (C) 1993, Thomas Koenig Copyright (C) 1993, Winning Strategies, Inc. Copyright (C) 1994, Christoph M. Robitschko Copyright (C) 1994, University of Maryland +Copyright (C) 1993, 1994, jc@irbs.UUCP (John Capo), + vak@zebub.msk.su (Serge Vakulenko), + ache@astral.msk.su (Andrew A. Chernov) -$Id: COPYRIGHT.FreeBSD,v 1.2 1994/02/20 02:51:25 rgrimes Exp $ +$Id: COPYRIGHT.FreeBSD,v 1.4 1994/06/28 08:09:29 jkh Exp $ diff --git a/COPYRIGHT.USL b/COPYRIGHT.USL index 851751885e59..8a7dd751090b 100644 --- a/COPYRIGHT.USL +++ b/COPYRIGHT.USL @@ -2,7 +2,7 @@ Copyright (c) UNIX System Laboratories, Inc. All or some portions of this software are derived from material licensed to the University of California by American Telephone and Telegraph Co. or UNIX System Laboratories, Inc. -and are reporduced herein with the permission of +and are reproduced herein with the permission of UNIX System Laboratories, Inc. Additionally, the following files contained herein constitute @@ -42,4 +42,4 @@ usr.bin/cpio/cpio.c [*] copyright and/or trade secret. -$Id: COPYRIGHT.USL,v 1.1.2.1 1994/05/04 06:32:01 rgrimes Exp $ +$Id: COPYRIGHT.USL,v 1.3 1994/05/18 22:53:56 rgrimes Exp $ diff --git a/KNOWNBUGS b/KNOWNBUGS index 0c0740af5f8c..781357d4b5dc 100644 --- a/KNOWNBUGS +++ b/KNOWNBUGS @@ -11,9 +11,6 @@ installed on your hard-drive is to 'bounce' on a key like shift or num-lock (which works well since you can see when the keyboard comes back to life) until the boot sequence is finished. The keyboard will work fine for installing FreeBSD onto the hard-drive. - Generally the problems go away at this point, but if it doesn't -you should install a SYSCONS kernel which doesn't experience these -keyboard problems. /usr/bin/gdb: The gdb in the release will not work on shared objects nor will it @@ -63,14 +60,14 @@ keyboard problems. memory. If you find this to be the case, temporarily remove your extra memory and contact Buslogic for an upgrade! -/usr/bin/find - find doesn't work on CDROM's. You need to call find with the - "fstype isofs" argument to get it working. The bug seems to be - in the "fts(3)" routines that find uses. +fsck: + fsck can go into an endless loop in the repair/fsck cycle on + a corrupted filesystem. The message "VALUES IN SUPER BLOCK + DISAGREE WITH THOSE IN FIRST ALTERNATE" is very misleading. + fsck compares the superblock with the alternate in the last + cylinder group? So if this block is corrupt, you have no chance + to get the filesystem repaired. You can answer on the question + "UPDATE STANDARD SUPERBLOCK" with yes and get always the same + error message on the next fsck. -/usr/bin/awk - awk dumps core for the following command line "awk '' blubber". - Problem is already known by the gawk maintainers and will be fixed - in the next release of gawk. - -$Id: KNOWNBUGS,v 1.7.2.6 1994/05/01 20:58:17 rgrimes Exp $ +$Id: KNOWNBUGS,v 1.16 1994/06/04 10:39:55 jkh Exp $ diff --git a/MIRROR.SITES b/MIRROR.SITES index 6005e7201810..d6690a92f3c2 100644 --- a/MIRROR.SITES +++ b/MIRROR.SITES @@ -4,6 +4,15 @@ The FreeBSD software is being mirrored at the following locations: Country Site/Directory/Maintainer ======= ========================================================= +Australia minnie.cs.adfa.oz.au:/BSD/FreeBSD-1.1-RELEASE + + +Australia ftp.physics.su.oz.au:/FreeBSD + David Dawes + +Australia ftp.une.edu.au:/pub/FreeBSD + Gordon Smith + Austria ftp.tu-graz.ac.at:/pub/FreeBSD @@ -14,7 +23,7 @@ France ftp.ibp.fr:/pub/FreeBSD Germany ftp.informatik.tu-muenchen.de:/pub/comp/os/bsd/FreeBSD - + Germany ftp.uni-duisburg.de:/pub/unix/FreeBSD @@ -25,6 +34,9 @@ Germany gil.physik.rwth-aachen.de:/pub/FreeBSD Hong Kong ftp.cs.cuhk.hk:/pub/FreeBSD +Israel orgchem.weizmann.ac.il:/pub/FreeBSD + + Netherlands ftp.nl.net:/pub/os/FreeBSD @@ -32,10 +44,16 @@ Russia ftp.kiae.su:/FreeBSD UK src.doc.ic.ac.uk:/packages/FreeBSD - + -USA ftp.dsu.edu:/pub/FreeBSD - +USA gatekeeper.dec.com:/pub/BSD/FreeBSD + + +USA freebsd.uml.edu:/FreeBSD + + +USA wuarchive.wustl.edu:/systems/unix/FreeBSD + -$Id: MIRROR.SITES,v 1.7.2.1 1994/04/18 04:41:53 rgrimes Exp $ +$Id: MIRROR.SITES,v 1.16 1994/06/08 13:33:51 sean Exp $ diff --git a/Makefile b/Makefile index 4aa1c67ca56b..3b0826ab3215 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # @(#)Makefile 5.1.1.2 (Berkeley) 5/9/91 # -# $Id: Makefile,v 1.40 1994/02/18 02:03:17 rgrimes Exp $ +# $Id: Makefile,v 1.55 1994/06/15 21:30:28 adam Exp $ # SUBDIR= @@ -22,6 +22,13 @@ SUBDIR+= include .if exists(lib) SUBDIR+= lib .endif + +# This contains both libraries and includes, which stuff below depends +# upon. +.if exists(kerberosIV) && !defined(NOCRYPT) +SUBDIR+= kerberosIV +.endif + .if exists(libexec) SUBDIR+= libexec .endif @@ -60,6 +67,11 @@ CLEANDIR= CLEANDIR= cleandir .endif +# Where is the c-compiler source. Change this, and gnu/usr.bin/Makefile if you +# want to use another cc (gcc-2.5.8 for instance) +CCDIR= ${.CURDIR}/gnu/usr.bin/cc +#CCDIR= ${.CURDIR}/gnu/usr.bin/cc25 + world: directories cleandist mk includes libraries tools mdec @echo "--------------------------------------------------------------" @echo " Rebuilding ${DESTDIR} The whole thing" @@ -69,6 +81,9 @@ world: directories cleandist mk includes libraries tools mdec cd ${.CURDIR}/share/man; make makedb directories: + @echo "--------------------------------------------------------------" + @echo " Making directories" + @echo "--------------------------------------------------------------" cd ${.CURDIR}/etc; make distrib-dirs cleandist: @@ -107,7 +122,7 @@ mk: # DONT DO THIS!! chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/share/mk # DONT DO THIS!! chmod 755 ${DESTDIR}/usr/share/mk .endif - cd ${.CURDIR}/share/mk; make install; + cd ${.CURDIR}/share/mk; make clean all install; includes: @echo "--------------------------------------------------------------" @@ -120,11 +135,15 @@ includes: chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include chmod 755 ${DESTDIR}/usr/include .endif - cd ${.CURDIR}/include; make install - cd ${.CURDIR}/gnu/usr.bin/cc/libobjc; make beforeinstall + cd ${.CURDIR}/include; make clean all install + cd ${CCDIR}/libobjc; make beforeinstall cd ${.CURDIR}/gnu/lib/libg++; make beforeinstall + cd ${.CURDIR}/gnu/lib/libreadline; make beforeinstall cd ${.CURDIR}/lib/libcurses; make beforeinstall cd ${.CURDIR}/lib/libc; make beforeinstall +.if !defined(NOCRYPT) && exists(${.CURDIR}/kerberosIV) + cd ${.CURDIR}/kerberosIV/include; make clean all install +.endif # You MUST run this the first time you get the new sources to boot strap # the shared library tools onto you system. This target should only @@ -142,12 +161,39 @@ bootstrapld: directories cleandist mk includes cd ${.CURDIR}/usr.bin/strip; make -DNOPIC depend all install ${CLEANDIR} obj cd ${.CURDIR}/gnu/usr.bin/ld; make -DNOPIC depend all install ${CLEANDIR} obj cd ${.CURDIR}/gnu/usr.bin/as; make depend all install ${CLEANDIR} obj - cd ${.CURDIR}/gnu/usr.bin/cc; make -DNOPIC depend all install ${CLEANDIR} obj - cd ${.CURDIR}/gnu/usr.bin/cc/libgcc; make all install ${CLEANDIR} obj + cd ${CCDIR}; make -DNOPIC depend all install ${CLEANDIR} obj + cd ${CCDIR}/libgcc; make all install ${CLEANDIR} obj cd ${.CURDIR}/lib/csu.i386; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/lib/libc; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/gnu/usr.bin/ld/rtld; make depend all install ${CLEANDIR} obj +# Standard database make routines are slow especially for big passwd files. +# Moreover, *pwd.db bases are too big and waste root space. You can have +# much faster routines with small *pwd.db, but loose binary compatibility +# with previous versions and with other BSD-like systems. If you want to +# setup much faster routines, define envirnoment variable (f.e. 'setenv +# PW_COMPACT' in csh) and use target into /usr/src/Makefile. If you will +# want to return this changes back, use the same target without defining +# PW_COMPACT. + +bootstrappwd: #directories + -rm -f ${.CURDIR}/lib/libc/obj/getpwent.o ${.CURDIR}/lib/libc/getpwent.o + cd ${.CURDIR}/lib/libc; make all + -rm -f ${.CURDIR}/usr.sbin/pwd_mkdb/obj/pwd_mkdb.o ${.CURDIR}/usr.sbin/pwd_mkdb/pwd_mkdb.o + cd ${.CURDIR}/usr.sbin/pwd_mkdb; make all install ${CLEANDIR} + cp /etc/master.passwd /etc/mp.t; pwd_mkdb /etc/mp.t + SLIB=`basename ${.CURDIR}/lib/libc/obj/libc.so.*`; \ + cp ${.CURDIR}/lib/libc/obj/$$SLIB /usr/lib/$$SLIB.tmp; \ + mv /usr/lib/$$SLIB.tmp /usr/lib/$$SLIB + cd ${.CURDIR}/lib/libc; make install ${CLEANDIR} + cd ${.CURDIR}/usr.bin/passwd; make clean all install ${CLEANDIR} + cd ${.CURDIR}/usr.bin/chpass; make clean all install ${CLEANDIR} + cd ${.CURDIR}/bin; make clean all install ${CLEANDIR} + cd ${.CURDIR}/sbin; make clean all install ${CLEANDIR} + @echo "--------------------------------------------------------------" + @echo " Do a reboot now because all daemons need restarting" + @echo "--------------------------------------------------------------" + libraries: # setenv NOPROFILE if you do not want profiled libraries @echo "--------------------------------------------------------------" @@ -158,18 +204,24 @@ libraries: find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | xargs -n30 rm -rf .endif cd ${.CURDIR}/lib; make depend all install ${CLEANDIR} obj - cd ${.CURDIR}/gnu/usr.bin/cc/libgcc; make depend all install ${CLEANDIR} obj + cd ${CCDIR}/libgcc; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/gnu/lib/libg++; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/gnu/lib/libregex; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/gnu/lib/libmalloc; make depend all install ${CLEANDIR} obj + cd ${.CURDIR}/gnu/lib/libreadline; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/usr.bin/lex; make depend all install ${CLEANDIR} obj +.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) + cd ${.CURDIR}/kerberosIV/des; make depend all install ${CLEANDIR} obj + cd ${.CURDIR}/kerberosIV/krb; make depend all install ${CLEANDIR} obj + cd ${.CURDIR}/kerberosIV/kdb; make depend all install ${CLEANDIR} obj +.endif tools: @echo "--------------------------------------------------------------" @echo " Rebuilding ${DESTDIR} Compiler and Make" @echo "--------------------------------------------------------------" @echo - cd ${.CURDIR}/gnu/usr.bin/cc; make depend all install ${CLEANDIR} obj + cd ${CCDIR}; make depend all install ${CLEANDIR} obj cd ${.CURDIR}/usr.bin/make; make depend all install ${CLEANDIR} obj mdec: diff --git a/REGISTER.FreeBSD b/REGISTER.FreeBSD new file mode 100644 index 000000000000..4b1432510b40 --- /dev/null +++ b/REGISTER.FreeBSD @@ -0,0 +1,86 @@ +In the absence of any other mechanism for counting the number of users +of FreeBSD, we like to as kindly suggest that you take a few minutes +to please register with the counter set up by +. + +The justification for such "registration" is twofold: First, we sincerely do +wish to know just what the size and demographics of our user-base are +in order to better support its needs. Second, it's a sad fact that many +people rely on counters and statistics (even when highly dubious) rather +than 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 +"marketing" remains an undeniable fact of life. + +The FreeBSD team does not necessarily feel that Harald's counter represents +the best approach to such statistics gathering, and its accuracy will only +be as good as people's willingness to register with it (which 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 " + +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 + +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/06/04 10:39:57 jkh Exp $ diff --git a/RELNOTES.FreeBSD b/RELNOTES.FreeBSD index 534d8056e850..729fff2f2d15 100644 --- a/RELNOTES.FreeBSD +++ b/RELNOTES.FreeBSD @@ -1,29 +1,35 @@ RELEASE NOTES FreeBSD - Release 1.1 + Release 1.1.5 1. Technical overview --------------------- FreeBSD is a freely available, full source 4.3 (+4.4 enhancements) BSD release for Intel i386/i486 (or compatable) based PC's. It is based -heavily on Bill Jolitz's 386BSD 0.1, with additions from "the patchkit", +on Bill Jolitz's 386BSD 0.1, with additions from "the patchkit", NetBSD, CSRG, and the Free Software Foundation. -Many hundreds of bugs from the 386BSD 0.1 distribution were fixed, -and many out-of-date pieces of software were upgraded to their current -releases in the GAMMA distribution. This 1.0 distribution fixes -many of the first-run problems our GAMMA and EPSILON users reported back -to us. +Since our first release of FreeBSD 1.0, many hundreds of bugs have been +fixed, features added, and the overall quality of the system improved +almost imeasurably. FreeBSD 1.1.5 represents the culmination of almost +18 months of work and many thousands of man hours put in by our all-volunteer +working group. We hope you enjoy it! -Additionally, many packages such as XFree86 2.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 then next section of this document -for more details. +Many packages have also been upgraded or added, such as XFree86 2.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 next +section of this document for more details. For a list of contributors, please see the files "CONTRIB.FreeBSD" and "CONTRIB.386BSD", which should be bundled with your distribution. +Also see the new "REGISTER.FreeBSD" file for information on registering +with the "Free BSD user counter". We've also provided a list of who's +responsible for what (so that you may query them directly) in the +"ROSTER.FreeBSD" file; use of this file is encouraged to ensure faster +resolution of an problems you may have! + 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 @@ -36,8 +42,8 @@ and is described in the FreeBSD FAQ. 2. Supported Configurations --------------------------- -FreeBSD currently runs on a wide variety of ISA and EISA bus based -PC's, ranging from 386sx to 486 class machines (though the 386sx is +FreeBSD currently runs on a wide variety of ISA, 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. @@ -61,18 +67,24 @@ Adaptec 174x series EISA SCSI controller in standard and enhanced mode. Buslogic 545S. Buslogic 445S VLB SCSI controller Buslogic 742A and 747. +Buslogic 942A PCI + Please see special notes in /usr/src/KNOWNBUGS (filed under bt742a.c) for details concerning possible buggy firmware and undocumented switch settings -that may be necessary for proper operation of your controller. +that may be necessary for proper operation of your Bt445S controller. DTC 3290 EISA SCSI controller in 1542 emulation mode. Ultra Store 14F and 34F. +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 -inteface card) is the only way a CD ROM drive may be currently +interface card) is the only way a CD ROM drive may be currently attached to a FreeBSD system; we do not support SoundBlaster CDROM interface, or other "mini SCSI" adapters. @@ -84,7 +96,9 @@ 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. +controllers. In the cases where it's necessary, the system will use +"bounce buffers" to to talk to the controller so that you can still use +more than 16Mb of memory without difficulty. 2.2. Ethernet cards @@ -110,9 +124,9 @@ SMC Elite Ultra 2.3. Misc -Various 2 and 4 port serial/parallel cards. +AST 4 port serial card using shared IRQ. -Simple (AST-like) multiport serial cards. +ARNET 8 port serial card using shared IRQ. BOCA ATIO66 6 port serial card using shared IRQ. @@ -125,7 +139,7 @@ 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 they develop. +as the situation develops. 3. Obtaining FreeBSD. @@ -153,7 +167,7 @@ resort! 2. CDROM -FreeBSD may be ordered on CDROM from: +FreeBSD 1.1 may be ordered on CDROM from: Walnut Creek CDROM 4041 Pike Lane, Suite D @@ -245,21 +259,21 @@ The Computer Systems Research Group (CSRG), U.C. Berkeley. Bill Jolitz, for his extensive work with 386BSD. -The FreeBSD "core" group: +The FreeBSD "core" team: - Andrew A. Chernov - John Dyson - David Greenman - Rodney W. Grimes - Jordan K. Hubbard - Scott Mace - Andrew Moore - Rich Murphey - Paul Richards - Christoph Robitschko - Andreas Schulz - Nate Williams - Garrett A. Wollman + Andrew A. Chernov + John Dyson + David Greenman + Rodney W. Grimes + Jordan K. Hubbard + Scott Mace + Andrew Moore + Rich Murphey + Geoff Rehmet + Paul Richards + Andreas Schulz + Nate Williams + Garrett A. Wollman Special mention to: @@ -285,6 +299,7 @@ Special mention to: Chris Provenzano Dave Rivers Guido van Rooij Steven Wallace Rick Weldon Terry Williams + Atsushi Murai And everyone at Montana State University for their initial support. @@ -293,6 +308,6 @@ Thanks to everyone, especially those not mentioned, and we sincerely hope you enjoy this release of FreeBSD! - The FreeBSD Core Group + The FreeBSD Core Team -$Id: RELNOTES.FreeBSD,v 1.23.2.4 1994/05/02 02:23:48 rgrimes Exp $ +$Id: RELNOTES.FreeBSD,v 1.34 1994/06/28 08:09:31 jkh Exp $ diff --git a/ROSTER.FreeBSD b/ROSTER.FreeBSD new file mode 100644 index 000000000000..9972cf4fee11 --- /dev/null +++ b/ROSTER.FreeBSD @@ -0,0 +1,127 @@ +This file attempts to document just who is `responsible' for what in +the FreeBSD world. Since we're an all-volunteer group, the whole +concept of `responsibility' must, of course, be taken with a grain of +salt since the folks here may not always have time to deal with your +problem right away. With that in mind, you are encouraged to contact +these folks directly when your problem or suggestion clearly falls +into their area of responsibility. If your queries don't net any +positive results in, say, 48 hours, THEN you should try and contact +the group at large. In most cases, however, using these folks as +first-contacts will both cut down on our mail-overload and give you +faster service. + +Thank you! + + The FreeBSD Team + freebsd-hackers@freefall.cdrom.com + +--- + + +Legend: +------- +contrib = Contributed +doc = Documentation +lib = User-land library +misc = Misc user-land utility (contrib, other) +ports = Ported software in /usr/ports +prog = User-land program +share = Support data files +sys = Kernel and system code +tools = DOS support utilities + +Category Person Email address +=============================================================================== +contrib/xntpd Garrett Wollman wollman@lcs.mit.edu +doc/FAQ FAQ Team freebsd-faq@freefall.cdrom.com +lib/libF77 L. Jonas Olsson ljo@po.cwru.edu +lib/libc Garrett Wollman wollman@lcs.mit.edu +lib/libcrypt (non-US) Geoff Rehmet csgr@cs.ru.ac.za +lib/libcurses Andrew Chernov ache@astral.msk.su +lib/libkrb Garrett Wollman wollman@lcs.mit.edu +lib/libm Andrew Moore alm@netcom.com +lib/libpthread Chris Provenzano proven@mit.edu +lib/libskey Guido van Rooij guido@gvr.win.tue.nl +lib/libtelnet Garrett Wollman wollman@lcs.mit.edu +misc/addit Gary Clark II gclarkii@freefall.cdrom.com +misc/configit Gary Clark II gclarkii@freefall.cdrom.com +misc/gnats Andrew Moore alm@netcom.com +misc/manctl Geoff Rehmet csgr@cs.ru.ac.za +ports/{not below} Andrew Moore alm@freefall.cdrom.com +ports/aXe Jordan Hubbard jkh@freefall.cdrom.com +ports/archivers Scott Mace smace@freefall.cdrom.com +ports/bash Jordan Hubbard jkh@freefall.cdrom.com +ports/blt Jordan Hubbard jkh@freefall.cdrom.com +ports/cpm Joerg Wunsch joerg_wunsch@uriah.sax.de +ports/dgd Adam David adam@veda.is +ports/elm Scott Mace smace@freefall.cdrom.com +ports/emacs Jordan Hubbard jkh@freefall.cdrom.com +ports/exmh Jordan Hubbard jkh@freefall.cdrom.com +ports/ezd Jeffrey Hsu hsu@freefall.cdrom.com +ports/franz Jordan Hubbard jkh@freefall.cdrom.com +ports/fvwm Geoff Rehmet csgr@cs.ru.ac.za +ports/golddig Jeffrey Hsu hsu@freefall.cdrom.com +ports/ile Jordan Hubbard jkh@freefall.cdrom.com +ports/ispell Piero Serini piero@strider.st.dsi.unimi.it +ports/jpeg Scott Mace smace@freefall.cdrom.com +ports/kermit Scott Mace smace@freefall.cdrom.com +ports/ksh Sean Vickery seanv@cs.uq.edu.au +ports/kterm Satoshi Asami asami@cs.berkeley.edu +ports/lynx Serge V.Vakulenko vak@cronyx.msk.su +ports/mprof Jeffrey Hsu hsu@freefall.cdrom.com +ports/mtools Steven Wallace swallace@freefall.cdrom.com +ports/netaudio Jeffrey Hsu hsu@freefall.cdrom.com +ports/nethack Sean Vickery seanv@cs.uq.edu.au +ports/pcvt J"org Wunsch joerg_wunsch@uriah.sax.de +ports/piewm Satoshi Asami asami@cs.berkeley.edu +ports/pkg_install Jordan Hubbard jkh@freefall.cdrom.com +ports/popper Andreas Schulz ats@g386bsd.first.gmd.de +ports/point Jordan Hubbard jkh@freefall.cdrom.com +ports/sather Jeffrey Hsu hsu@freefall.cdrom.com +ports/schemetoc Jeffrey Hsu hsu@freefall.cdrom.com +ports/scm Jeffrey Hsu hsu@freefall.cdrom.com +ports/seahaven Jeffrey Hsu hsu@freefall.cdrom.com +ports/sml Jeffrey Hsu hsu@freefall.cdrom.com +ports/sup Jordan Hubbard jkh@freefall.cdrom.com +ports/tcl Jordan Hubbard jkh@freefall.cdrom.com +ports/tcl-dp Jordan Hubbard jkh@freefall.cdrom.com +ports/tclX Jordan Hubbard jkh@freefall.cdrom.com +ports/tcsh Scott Mace smace@freefall.cdrom.com +ports/tk Jordan Hubbard jkh@freefall.cdrom.com +ports/vile Jordan Hubbard jkh@freefall.cdrom.com +ports/vim Jordan Hubbard jkh@freefall.cdrom.com +ports/wine Jeffrey Hsu hsu@freefall.cdrom.com +ports/wu-ftpd Justin T. Gibbs gibbs@freefall.cdrom.com +ports/xcdplayer Steven Wallace swallace@freefall.cdrom.com +ports/xjewel Jeffrey Hsu hsu@freefall.cdrom.com +ports/xlock Scott Mace smace@freefall.cdrom.com +ports/xmine J"org Wunsch joerg_wunsch@uriah.sax.de +ports/xphoon Satoshi Asami asami@cs.berkeley.edu +ports/xv Scott Mace smace@freefall.cdrom.com +ports/ytalk Geoff Rehmet csgr@cs.ru.ac.za +ports/zircon Jordan Hubbard jkh@freefall.cdrom.com +ports/zsh Scott Mace smace@freefall.cdrom.com +prog/cc Poul-Henning Kamp phk@freefall.cdrom.com +prog/cc25 Poul-Henning Kamp phk@freefall.cdrom.com +prog/gdb Gary Jennejohn gj@pcs.dec.com +prog/man Jordan Hubbard jkh@freefall.cdrom.com +prog/telnet Garrett Wollman wollman@lcs.mit.edu +sys/fd J"org Wunsch joerg_wunsch@uriah.sax.de +sys/fd Serge V.Vakulenko vak@cronyx.msk.su +sys/i386 David Greenman davidg@root.com +sys/i386/isa/seagate Sean Vickery seanv@cs.uq.edu.au +sys/i386/isa/sound Steven Wallace swallace@freefall.cdrom.com +sys/i386/isa/bt742*.c Atsushi Murai amurai@spec.co.jp +sys/kern David Greenman davidg@root.com +sys/kern/ntp Garrett Wollman wollman@lcs.mit.edu +sys/lpt Geoff Rehmet csgr@cs.ru.ac.za +sys/net* David Greenman davidg@root.com +sys/netboot Martin Renters martin@innovus.com +sys/netinet Garrett Wollman wollman@lcs.mit.edu +sys/pcmcia Poul-Henning Kamp phk@freefall.cdrom.com +sys/scheduler John Dyson dyson@freefall.cdrom.com +sys/syscons So/ren Schmidt sos@freefall.cdrom.com +sys/vm David Greenman davidg@root.com +sys/vm John Dyson dyson@freefall.cdrom.com +sys/wt Serge V.Vakulenko vak@cronyx.msk.su +tools/booteasy Serge V.Vakulenko vak@cronyx.msk.su diff --git a/SUPPORT.TXT b/SUPPORT.TXT index 1fac5fba7332..9397555e1c66 100644 --- a/SUPPORT.TXT +++ b/SUPPORT.TXT @@ -44,65 +44,46 @@ floppies and tape cartridges available. System software development including drivers for non-standard equipment. -Guy Helmer -519 West Ave. South -Madison, SD 57042 -Home: 605-256-2788 -Expires on 1995/06/30 - -Interests: supporting FreeBSD & XFree86 installation, configuration, -operation; Internet connection support; training. Prefer short-term -part-time projects in the northern midwest United States. I reserve the -right to refuse work. Rates negotiable. - -Degree: SDSM&T BS CS, 1989 - - Jordan Hubbard Timberline Associates (est 1978) -Dublin, Ireland +Dublin, Ireland [And soon Boston / San Francisco] Support hours: 1000 - 2300 GMT Tel #: 00353-1-332796 Email: jkh@al.org - -Telephone and on-site consulting for FreeBSD for Ireland, the United -Kingdom and most parts of Europe. Services include installation, -system configuration and custom software projects, graphical user -interfaces a specialty (actively involved with The X Window System -since Version 9). Reasonable and flexible rates comeasurate with -location and duration of assignment. +Telephone (or Internet) and on-site consulting for FreeBSD in Ireland, +the United States, United Kingdom and most parts of Europe. Services include +installation, system configuration, networking and custom software +projects, graphical user interfaces a specialty (actively involved with +The X Window System since Version 9 and contributor to the X Consortium). +Reasonable and flexible rates comensurate with location and duration of +assignment. Internet assignments are welcomed, and generally billed at +lower rates. +Vector Systems Ltd, Julian H. Stacey. +Post: Holz Strasse 27d, D 80469, Munich (Muenchen), Germany (Deutschland). +Tel.: +49 89 268616 09:00-22:00 TZ=GMT+1 +Email: stacey@freefall.cdrom.com -Vector Systems Ltd, -Julian H. Stacey, Holz Strasse 27d, 80469, Munich (Muenchen), Germany. -Tel. +49 89 268616 09:00-19:00 Timezone=GMT+01:00 -email: (later changing to ) - -COMMERCIAL Independent Consultancy: - Custom Project Designs, provision, & support, targeting all modern - Unix like platforms. Prefered development & target platform: FreeBSD. - Expertise in C, FSF/GNU tools, X Windows, multi lingual systems - (inc. Cyrillic), systems engineering, hardware interfacing, - communications & scientific & industrial programming. - Generally avoiding: cobol, basic, payroll applications. - Support & Provision available for combinations of - FreeBSD, X-Windows, FSF/GNU & range of own C tools for - all Unix + MSDOS. - Rate: ~125 DM/hour, (~2.5DM=#1UK, ~1.5DM=$1USA @ Nov. 93). -On Request: - Personal Resume, Company Profile, Index of own purchasable tools, - Index of public domain tools. -Deutsch + Francais: - Man kann mir in Deutsch schreiben, (oder mich anrufen). - Je comprend Francais, mais je n'ecris pas des responses en Francais. - (Contact me in English, German, or French. -Public Domain Copies: - Selections of FreeBSD, X-Windows, FSF/GNU Sources & Binaries available. - 525, 150, & 60 Mbyte QIC Cartridge, TEAC 60M Cassette, 1.2&4M Floppies. - From about 100DM per Cartridge for labour, media, postage. +Custom designs & support using FreeBSD + X-Windows + FSF/GNU, + own Unix & DOS +C tools. Systems engineering, hardware interfacing, multi lingual systems +(European, Cyrillic, Chinese), communications, scientific, industrial real +time programming. Source Tapes: QIC 525M, 150M, 60M. +Deutsch: Man kann mir in Deutsch schreiben, (oder mich anrufen). +Francais: Je comprend Francais, mais je n'ecris pas des responses en Francais. +Sean Vickery +2/449 Milton Road +Auchenflower Qld 4066 +Australia +Telephone: +61 (0)7 870 5241 + Email: seanv@cs.uq.edu.au -$Id: SUPPORT.TXT,v 1.1.2.1 1994/04/21 19:06:31 rgrimes Exp $ +Sean offers support in most FreeBSD matters, including installation +and configuration. His rates are reasonable. As well as on-site +help, support is available over the phone and the net. + + +$Id: SUPPORT.TXT,v 1.5 1994/06/09 03:46:15 jkh Exp $ diff --git a/TODO-1.1.5 b/TODO-1.1.5 new file mode 100644 index 000000000000..66d1777a13a2 --- /dev/null +++ b/TODO-1.1.5 @@ -0,0 +1,38 @@ +This is my current TODO list for 1.1.5. Please feel free to add to +it, assuming that you've actually got some confidence that you or +someone else will be able to actually get to whatever it is (or it's +so critical that you don't think 1.1.5 could/should be released +without it). + +Also, please bear in mind the following milestones we have to hit: + +June 5th Feature Freeze (bug fixes and cleanup work only). +June 16th Code Freeze +June 20th Roll binaries - begin initial testing +June 23rd Announce availability of 1.1.5. + +(*) = Task is completed +(@) = Task is abandoned + +Task Urgency Who +------------------------------------------------------------------------------- +Floppy driver fixes Low * Joerg Wunsch +Sound driver (GUS/Multicast/cleanup) Medium Steven W/Andrew C. +Curses library problems Medium * Steven W. +SIO driver - reported problems High * Andrew C/Bruce E/??? +Syscons integration / new features High * Soren Schmidt/Jordan +Update FT driver Medium * Javier R/Steven G. +Update gdb High * Paul +Make pcfs less dangerous Low @ ??? +Bruce's disklabel and bad144 fixes Medium * Andrew C. +Misc NetBSD drivers for weird devices Low @ Geoff +Multicast Support Medium * Jordan +Bounce Buffer fixes High * John/David +VM panics and assorted lossage High * John/David +Secure Key support Low * Guido +Install script enhancements Medium * Andrew M/Jordan +Fsck/umount cooperation with dirty bit Low @ Paul R. +PCFS data corruption with cp Medium * Steven W./ATS +PCFS extended DOS partition support Low @ ??? +ISOFS over NSF fix Medium/High * ??? +Libcompat Low * Joerg Wunsch diff --git a/bin/cp/cp.c b/bin/cp/cp.c index e21bba631e9d..97375b17d1a1 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -299,7 +299,7 @@ copy_file(fs, dne) struct stat *fs; int dne; { - static char buf[MAXBSIZE]; + static char buf[MAXBSIZE * 4]; register int from_fd, to_fd, rcount, wcount; struct stat to_stat; char *p; @@ -358,7 +358,7 @@ copy_file(fs, dne) if (munmap((caddr_t) p, fs->st_size) < 0) err("%s: %s", from.p_path, strerror(errno)); } else { - while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { + while ((rcount = read(from_fd, buf, sizeof(buf))) > 0) { wcount = write(to_fd, buf, rcount); if (rcount != wcount || wcount == -1) { err("%s: %s", to.p_path, strerror(errno)); diff --git a/bin/cp/path.c b/bin/cp/path.c index a84892193554..170460283522 100644 --- a/bin/cp/path.c +++ b/bin/cp/path.c @@ -50,7 +50,7 @@ static char sccsid[] = "@(#)path.c 5.2 (Berkeley) 10/27/91"; */ #define STRIP_TRAILING_SLASH(p) { \ - while ((p)->p_end > (p)->p_path && (p)->p_end[-1] == '/') \ + while ((p)->p_end > ((p)->p_path + 1) && (p)->p_end[-1] == '/') \ *--(p)->p_end = 0; \ } diff --git a/bin/csh/char.c b/bin/csh/char.c index f552a28684a5..eb2dab68bf10 100644 --- a/bin/csh/char.c +++ b/bin/csh/char.c @@ -63,10 +63,10 @@ unsigned short _cmap[256] = { _CTR, _CTR, _CTR, _CTR, /* sp ! " # */ - _SP|_META, 0, _Q, _META, + _SP|_META, 0, _Q2, _META, /* $ % & ' */ - _DOL, 0, _META|_CMD, _Q, + _DOL, 0, _META|_CMD, _Q2, /* ( ) * + */ _META|_CMD, _META, _GLOB, 0, diff --git a/bin/csh/char.h b/bin/csh/char.h index 297a6ee8e1e2..475436879180 100644 --- a/bin/csh/char.h +++ b/bin/csh/char.h @@ -42,7 +42,7 @@ extern unsigned char _cmap_lower[], _cmap_upper[]; #endif -#define _Q 0x0001 /* '" */ +#define _Q2 0x0001 /* '" */ #define _Q1 0x0002 /* ` */ #define _SP 0x0004 /* space and tab */ #define _NL 0x0008 /* \n */ diff --git a/bin/csh/dol.c b/bin/csh/dol.c index d2b28f5433b1..816b45840664 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -66,7 +66,7 @@ static Char *Dcp, **Dvp; /* Input vector for Dreadc */ #define unDgetC(c) Dpeekc = c -#define QUOTES (_Q|_Q1|_ESC) /* \ ' " ` */ +#define QUOTES (_Q2|_Q1|_ESC) /* \ ' " ` */ /* * The following variables give the information about the current @@ -192,7 +192,7 @@ Dpack(wbuf, wp) Gcat(STRNULL, wbuf); return (NULL); } - if (cmap(c, _SP | _NL | _Q | _Q1)) { /* sp \t\n'"` */ + if (cmap(c, _SP | _NL | _Q2 | _Q1)) { /* sp \t\n'"` */ unDgetC(c); if (cmap(c, QUOTES)) return (wp); diff --git a/bin/csh/lex.c b/bin/csh/lex.c index 63af5da774a4..75fb7e3a7f70 100644 --- a/bin/csh/lex.c +++ b/bin/csh/lex.c @@ -315,7 +315,7 @@ loop: break; } } - else if (cmap(c, _META | _Q | _Q1 | _ESC)) { + else if (cmap(c, _META | _Q2 | _Q1 | _ESC)) { if (c == '\\') { c = getC(0); if (c == '\n') { @@ -327,7 +327,7 @@ loop: *wp++ = '\\', --i; c |= QUOTE; } - else if (cmap(c, _Q | _Q1)) { /* '"` */ + else if (cmap(c, _Q2 | _Q1)) { /* '"` */ c1 = c; dolflg = c == '"' ? DOALL : DOEXCL; } @@ -366,7 +366,7 @@ getC1(flag) if ((c = *lap++) == 0) lap = 0; else { - if (cmap(c, _META | _Q | _Q1)) + if (cmap(c, _META | _Q2 | _Q1)) c |= QUOTE; return (c); } diff --git a/bin/df/df.c b/bin/df/df.c index a28a862cc09b..ecebfe85baac 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -5,7 +5,7 @@ * or UNIX System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * - * $Id: df.c,v 1.3.2.2 1994/05/04 07:35:01 rgrimes Exp $ + * $Id: df.c,v 1.5 1994/05/04 08:04:22 rgrimes Exp $ */ /* * Copyright (c) 1980, 1990 The Regents of the University of California. diff --git a/bin/ed/Makefile b/bin/ed/Makefile index a99763cc9202..7ecca79081d9 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -1,5 +1,5 @@ PROG= ed -SRCS= buf.c cbc.c glob.c io.c main.c re.c sub.c undo.c +SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 diff --git a/bin/ed/buf.c b/bin/ed/buf.c index f5b8045ebb3b..70275990c9ae 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -26,10 +26,11 @@ * SUCH DAMAGE. */ #ifndef lint -static char *rcsid = "@(#)$Id: buf.c,v 1.4 1994/02/01 00:34:35 alm Exp $"; +static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; #endif /* not lint */ #include +#include #include "ed.h" @@ -131,7 +132,7 @@ add_line_node(lp) line_t *cp; cp = get_addressed_line_node(current_addr); /* this get_addressed_line_node last! */ - insque(lp, cp); + INSQUE(lp, cp); addr_last++; current_addr++; } @@ -195,13 +196,18 @@ char sfn[15] = ""; /* scratch file name */ int open_sbuf() { + int u; + isbinary = newline_added = 0; + u = umask(077); strcpy(sfn, "/tmp/ed.XXXXXX"); if (mktemp(sfn) == NULL || (sfp = fopen(sfn, "w+")) == NULL) { fprintf(stderr, "%s: %s\n", sfn, strerror(errno)); sprintf(errmsg, "cannot open temp file"); + umask(u); return ERR; } + umask(u); return 0; } diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 9d1d9894583e..ee5285cdd0ec 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -38,7 +38,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp $"; +static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; #endif /* not lint */ #include diff --git a/bin/ed/ed.h b/bin/ed/ed.h index 1f61428eb73a..dd638806c470 100644 --- a/bin/ed/ed.h +++ b/bin/ed/ed.h @@ -24,14 +24,15 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)$Id: ed.h,v 1.5 1994/02/01 00:34:39 alm Exp $ + * @(#)ed.h,v 1.5 1994/02/01 00:34:39 alm Exp */ +#include #if defined(BSD) && BSD >= 199103 || defined(__386BSD__) # include /* for MAXPATHLEN */ #endif #include -#ifdef sun +#if defined(sun) || defined(__NetBSD__) # include #endif #include @@ -166,17 +167,15 @@ if ((i) > (n)) { \ /* REQUE: link pred before succ */ #define REQUE(pred, succ) (pred)->q_forw = (succ), (succ)->q_back = (pred) -#ifdef NEED_INSQUE -/* insque: insert elem in circular queue after pred */ -#define insque(elem, pred) \ +/* INSQUE: insert elem in circular queue after pred */ +#define INSQUE(elem, pred) \ { \ REQUE((elem), (pred)->q_forw); \ REQUE((pred), elem); \ } -/* remque: remove_lines elem from circular queue */ -#define remque(elem) REQUE((elem)->q_back, (elem)->q_forw); -#endif /* NEED_INSQUE */ +/* REMQUE: remove_lines elem from circular queue */ +#define REMQUE(elem) REQUE((elem)->q_back, (elem)->q_forw); /* NUL_TO_NEWLINE: overwrite ASCII NULs with newlines */ #define NUL_TO_NEWLINE(s, l) translit_text(s, l, '\0', '\n') @@ -184,7 +183,7 @@ if ((i) > (n)) { \ /* NEWLINE_TO_NUL: overwrite newlines with ASCII NULs */ #define NEWLINE_TO_NUL(s, l) translit_text(s, l, '\n', '\0') -#ifndef strerror +#ifdef sun # define strerror(n) sys_errlist[n] #endif diff --git a/bin/ed/glob.c b/bin/ed/glbl.c similarity index 98% rename from bin/ed/glob.c rename to bin/ed/glbl.c index 5c77d224cdff..1e21d99d2876 100644 --- a/bin/ed/glob.c +++ b/bin/ed/glbl.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: glob.c,v 1.1 1994/02/01 00:34:40 alm Exp $"; +static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; #endif /* not lint */ #include diff --git a/bin/ed/io.c b/bin/ed/io.c index 0c63f3dc77fb..2187cb999415 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: io.c,v 1.1 1994/02/01 00:34:41 alm Exp $"; +static char *rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/ed/main.c b/bin/ed/main.c index ddaf513f4337..f177b86ecd9d 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -33,7 +33,7 @@ char *copyright = #endif /* not lint */ #ifndef lint -static char *rcsid = "@(#)$Id: main.c,v 1.1 1994/02/01 00:34:42 alm Exp $"; +static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; #endif /* not lint */ /* diff --git a/bin/ed/re.c b/bin/ed/re.c index f4b9f292944b..0e04dd83dd9f 100644 --- a/bin/ed/re.c +++ b/bin/ed/re.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: re.c,v 1.6 1994/02/01 00:34:43 alm Exp $"; +static char *rcsid = "@(#)re.c,v 1.6 1994/02/01 00:34:43 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/ed/sub.c b/bin/ed/sub.c index c93d258c8cd2..9d46a7ca3d2e 100644 --- a/bin/ed/sub.c +++ b/bin/ed/sub.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: sub.c,v 1.1 1994/02/01 00:34:44 alm Exp $"; +static char *rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/ed/undo.c b/bin/ed/undo.c index a12e1c48e753..a686d14c1b36 100644 --- a/bin/ed/undo.c +++ b/bin/ed/undo.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char *rcsid = "@(#)$Id: undo.c,v 1.1 1994/02/01 00:34:44 alm Exp $"; +static char *rcsid = "@(#)undo.c,v 1.1 1994/02/01 00:34:44 alm Exp"; #endif /* not lint */ #include "ed.h" diff --git a/bin/expr/expr.1 b/bin/expr/expr.1 index 3cfa19b8f589..e6af35a40b17 100644 --- a/bin/expr/expr.1 +++ b/bin/expr/expr.1 @@ -28,7 +28,7 @@ .\" (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: expr.1,v 1.2.2.1 1994/05/01 15:59:55 jkh Exp $ +.\" $Id: expr.1,v 1.3 1994/04/24 01:18:46 jkh Exp $ .\" .Dd July 3, 1993 .Dt EXPR 1 diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 1363d00f80ae..cfcd293a6474 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -34,7 +34,7 @@ .\" .\" @(#)ls.1 6.18 (Berkeley) 6/27/91 .\" -.\" $Header: /home/cvs/386BSD/src/bin/ls/ls.1,v 1.2.2.1 1994/05/01 16:00:04 jkh Exp $ +.\" $Header: /home/cvs/386BSD/src/bin/ls/ls.1,v 1.3 1994/04/24 01:18:52 jkh Exp $ .\" .Dd June 27, 1991 .Dt LS 1 diff --git a/bin/mkdir/mkdir.1 b/bin/mkdir/mkdir.1 index d8d598e4b4d2..85d2387fddcc 100644 --- a/bin/mkdir/mkdir.1 +++ b/bin/mkdir/mkdir.1 @@ -34,7 +34,7 @@ .\" .\" @(#)mkdir.1 6.9 (Berkeley) 6/27/91 .\" -.\" $Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.1,v 1.2.2.1 1994/05/01 16:00:13 jkh Exp $ +.\" $Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.1,v 1.2 1993/07/21 22:54:08 conklin Exp $ .\" .Dd June 27, 1991 .Dt MKDIR 1 diff --git a/bin/mkdir/mkdir.c b/bin/mkdir/mkdir.c index b4ec95857c9e..4f59865a8e94 100644 --- a/bin/mkdir/mkdir.c +++ b/bin/mkdir/mkdir.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint static char sccsid[] = "@(#)mkdir.c 5.7 (Berkeley) 5/31/90"; -static char rcsid[] = "$Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.c,v 1.2 1993/07/21 22:54:09 conklin Exp $"; +static char rcsid[] = "$Header: /home/cvs/386BSD/src/bin/mkdir/mkdir.c,v 1.3 1994/05/23 01:15:19 ache Exp $"; #endif /* not lint */ #include @@ -118,7 +118,7 @@ build(path, mode, dir_mode) int ch; for (p = path;; ++p) { - if (!*p || *p == '/') { + if (!*p || *p == '/' && p != path) { ch = *p; *p = '\0'; if (stat(path, &sb)) { diff --git a/bin/mv/mv.c b/bin/mv/mv.c index aa37d0229f72..8fa66bb78f17 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -42,7 +42,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)mv.c 5.11 (Berkeley) 4/3/91";*/ -static char rcsid[] = "$Id: mv.c,v 1.2 1993/11/22 23:54:24 jtc Exp $"; +static char rcsid[] = "$Id: mv.c,v 1.3 1994/04/16 00:51:13 davidg Exp $"; #endif /* not lint */ #include @@ -229,7 +229,7 @@ fastcopy(from, to, sbp) (void)close(from_fd); return(1); } - if (!blen && !(bp = malloc(blen = sbp->st_blksize))) { + if (!blen && !(bp = malloc(blen = sbp->st_blksize * 4))) { error(NULL); return(1); } diff --git a/bin/rcp/Makefile b/bin/rcp/Makefile index e8cac815eb55..aea1fdd7ba92 100644 --- a/bin/rcp/Makefile +++ b/bin/rcp/Makefile @@ -1,15 +1,15 @@ # @(#)Makefile 5.4 (Berkeley) 10/21/90 PROG= rcp -SRCS= rcp.c +SRCS= rcp.c krcmd.c kcmd.c BINOWN= root BINMODE=4555 .PATH: ${.CURDIR}/../../usr.bin/rlogin -.if exists(/usr/lib/libcrypt.a) -#CFLAGS+=-DCRYPT -DKERBEROS -#DPADD+= ${LIBCRYPT} ${LIBKRB} -#LDADD+= -lcrypt -lkrb +.if exists(${DESTDIR}/usr/lib/libkrb.a) +CFLAGS+=-DCRYPT -DKERBEROS +DPADD+= ${LIBKRB} ${LIBDES} +LDADD+= -lkrb -ldes .endif .include diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 45d74488b7fd..d0cf0d2b7bfd 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rm.c 4.26 (Berkeley) 3/10/91";*/ -static char rcsid[] = "$Id: rm.c,v 1.6.2.1 1994/03/07 02:25:28 rgrimes Exp $"; +static char rcsid[] = "$Id: rm.c,v 1.7 1994/03/05 16:12:06 ats Exp $"; #endif /* not lint */ #include diff --git a/bin/rmail/rmail.c b/bin/rmail/rmail.c index 40e16887d7c9..7672cbfc44c1 100644 --- a/bin/rmail/rmail.c +++ b/bin/rmail/rmail.c @@ -163,7 +163,6 @@ main(argc, argv) i = 0; args[i++] = _PATH_SENDMAIL; args[i++] = "-oee"; /* no errors, just status */ - args[i++] = "-odq"; /* queue it, don't try to deliver */ args[i++] = "-oi"; /* ignore '.' on a line by itself */ if (fsys[0] != '\0') { /* set sender's host name */ static char junk2[512]; diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c index b67393827094..b39e4e45e82d 100644 --- a/bin/rmdir/rmdir.c +++ b/bin/rmdir/rmdir.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rmdir.c 5.3 (Berkeley) 5/31/90";*/ -static char rcsid[] = "$Id: rmdir.c,v 1.3 1993/11/23 00:13:55 jtc Exp $"; +static char rcsid[] = "$Id: rmdir.c,v 1.4 1994/05/23 01:41:06 ache Exp $"; #endif /* not lint */ /* @@ -117,6 +117,8 @@ rmdirp (path) /* skip trailing slash characters */ while (slash > path && *slash == '/') slash--; + if (*slash == '/') /* don't attempt to remove root */ + return 0; *++slash = '\0'; if (rmdir (path)) { diff --git a/bin/sh/builtins b/bin/sh/builtins index b605bd890533..a08020a82430 100644 --- a/bin/sh/builtins +++ b/bin/sh/builtins @@ -50,7 +50,7 @@ # This file is part of ash, which is distributed under the terms specified # by the Ash General Public License. See the file named LICENSE. -bltincmd command +bltincmd bltin #alloccmd alloc bgcmd -j bg breakcmd break continue diff --git a/bin/sh/cd.c b/bin/sh/cd.c index e458c1f0ae20..615ac7a38fd2 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -217,7 +217,7 @@ top: STPUTC('\0', p); p = grabstackstr(p); INTOFF; - if (chdir(p) < 0) { + if (chdir(*p ? p : ".") < 0) { INTON; return -1; } diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 95d2e504cd70..c350eae3ee7f 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -403,7 +403,7 @@ again: /* jump here after setting a variable with ${var=text} */ if ((c = *p++) == CTLESC) p++; else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) { - if (set) + if (set && argbackq) argbackq = argbackq->next; } else if (c == CTLVAR) { if ((*p++ & VSTYPE) != VSNORMAL) @@ -664,10 +664,10 @@ expandmeta(str) savelastp = exparg.lastp; INTOFF; if (expdir == NULL) - expdir = ckmalloc(8192); /* I hope this is big enough */ + expdir = ckmalloc(16384); /* I hope this is big enough */ expmeta(expdir, str->text); - if(strlen(expdir) >= 8192) - error("malloc overflow in sh:expand.c in ckmalloc(8192)\n"); + if(strlen(expdir) >= 16384) + error("malloc overflow in sh:expand.c in ckmalloc(16384)\n"); ckfree(expdir); expdir = NULL; INTON; diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index b14da674a166..3384cd5c8341 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -89,8 +89,8 @@ readcmd(argc, argv) char **argv; { out2str(prompt); flushall(); } - if ((ap = argptr) == NULL) - error("arg count"); + if (*(ap = argptr) == NULL) + error("bad argument/arg count"); if ((ifs = bltinlookup("IFS", 1)) == NULL) ifs = nullstr; status = 0; diff --git a/bin/stty/cchar.c b/bin/stty/cchar.c index b8e6206cfa59..c105f96c2081 100644 --- a/bin/stty/cchar.c +++ b/bin/stty/cchar.c @@ -60,12 +60,14 @@ struct cchar cchars1[] = { "intr", VINTR, CINTR, "kill", VKILL, CKILL, "lnext", VLNEXT, CLNEXT, + "min", VMIN, CMIN, "quit", VQUIT, CQUIT, "reprint", VREPRINT, CREPRINT, "start", VSTART, CSTART, "status", VSTATUS, CSTATUS, "stop", VSTOP, CSTOP, "susp", VSUSP, CSUSP, + "time", VTIME, CTIME, "werase", VWERASE, CWERASE, NULL, }; @@ -95,8 +97,8 @@ csearch(argvp, ip) tmp.name = name; if (!(cp = (struct cchar *)bsearch(&tmp, cchars1, sizeof(cchars1)/sizeof(struct cchar) - 1, sizeof(struct cchar), - c_cchar)) && !(cp = (struct cchar *)bsearch(&tmp, cchars1, - sizeof(cchars1)/sizeof(struct cchar) - 1, sizeof(struct cchar), + c_cchar)) && !(cp = (struct cchar *)bsearch(&tmp, cchars2, + sizeof(cchars2)/sizeof(struct cchar) - 1, sizeof(struct cchar), c_cchar))) return(0); @@ -109,10 +111,6 @@ csearch(argvp, ip) ip->t.c_cc[cp->sub] = _POSIX_VDISABLE; else if (cp->sub == VMIN || cp->sub == VTIME) { val = strtol(arg, &ep, 10); - if (val == _POSIX_VDISABLE) { - warnx("value of %ld would disable the option -- %s", - val, name); - } if (val > UCHAR_MAX) { warnx("maximum option value is %d -- %s", UCHAR_MAX, name); diff --git a/bin/stty/gfmt.c b/bin/stty/gfmt.c index d909131ee32c..97021bb31ba3 100644 --- a/bin/stty/gfmt.c +++ b/bin/stty/gfmt.c @@ -163,12 +163,12 @@ gread(tp, s) tp->c_cc[VSUSP] = tmp; continue; } - if (CHK("vmin")) { + if (CHK("min")) { (void)sscanf(ep, "%ld", &tmp); tp->c_cc[VMIN] = tmp; continue; } - if (CHK("vtime")) { + if (CHK("time")) { (void)sscanf(ep, "%ld", &tmp); tp->c_cc[VTIME] = tmp; continue; diff --git a/bin/stty/key.c b/bin/stty/key.c index 6a7aeca935e2..1f7114864058 100644 --- a/bin/stty/key.c +++ b/bin/stty/key.c @@ -276,6 +276,6 @@ f_tty(ip) int tmp; tmp = TTYDISC; - if (ioctl(0, TIOCSETD, &tmp) < 0) + if (ioctl(ip->fd, TIOCSETD, &tmp) < 0) err("TIOCSETD: %s", strerror(errno)); } diff --git a/bin/stty/print.c b/bin/stty/print.c index a3ef040efbec..fdd2f72c406d 100644 --- a/bin/stty/print.c +++ b/bin/stty/print.c @@ -74,6 +74,9 @@ print(tp, wp, ldisc, fmt) case NTTYDISC: cnt += printf("new tty disc; "); break; + case PPPDISC: + cnt += printf("ppp disc; "); + break; default: cnt += printf("#%d disc; ", ldisc); break; @@ -250,13 +253,14 @@ ccval(p, c) static char buf[5]; char *bp; - if (c == _POSIX_VDISABLE) - return(""); - if (p->sub == VMIN || p->sub == VTIME) { (void)snprintf(buf, sizeof(buf), "%d", c); return (buf); } + + if (c == _POSIX_VDISABLE) + return(""); + bp = buf; if (c & 0200) { *bp++ = 'M'; diff --git a/contrib/FAQ/FreeBSD.FAQ b/contrib/FAQ/FreeBSD.FAQ new file mode 100644 index 000000000000..9ea99a15613f --- /dev/null +++ b/contrib/FAQ/FreeBSD.FAQ @@ -0,0 +1,954 @@ + + FreeBSD + Frequently Asked Questions + For Versions 1.1 and above + +Please mail all suggestions and additions to + + +Revision: $Id: FreeBSD.FAQ,v 1.36 1994/06/28 15:33:58 jkh 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: + + + + +Some of the instructions here will also refer to auxiliary utilities +in the /usr/src/contrib/FAQ directory. CDROM purchasers and net folks +who've grabbed the FreeBSD 1.1 `srcdist' will have these files. If +you don't have the source distribution, then you can either grab the +whole thing from: + + FreeBSD.cdrom.com:pub/FreeBSD/FreeBSD-1.1 + +Or you can grab only those files you're interested in straight out of +the FreeBSD-current distribution in: + + FreeBSD.cdrom.com: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 + and include a single line saying +``help'' in the body of your message. + +FreeBSD-announce: For announcements about or on FreeBSD. +FreeBSD-hackers: Useful for persons wishing to work on the internals. +FreeBSD-questions: General questions on FreeBSD. +FreeBSD-bugs: Where bugs should be sent. +FreeBSD-commit: This list carries the commit messages for freefall. Useful + for tracking ongoing work. +FreeBSD-SCSI: Mailing list for SCSI developers. +FreeBSD-current: This list is for persons wishing to run FreeBSD-current + and carries announcements and discussions on current. + +Please see also the FreeBSD mailing list FAQ in: + + /usr/src/contrib/FAQ/OTHER-FAQS/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 +. + +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 + AH-1742 Series +Buslogic BT-445 Series (but see section 1.5) + BT-545 Series + BT-742 Series + BT-747 Series +Future Domain TMC-8XX/950 Series (1.1.5 ONLY) +Seagate ST-01/02 Series (1.1.5 ONLY) +UltraStor UH-14f Series + UH-34f Series + +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>: For the PS/2 mouse you need to look in +/usr/src/contrib/FAQ/programs/psm, which is John Solhed's port of the +Linux PS/2 mouse driver. + +Follow the directions in the package. You will also need to change +your Xconfig file to point to the mouse. + +<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/OTHER-FAQS/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. + + + +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 + 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>: The problem here is due to the current FreeBSD math-emulator. You +need to pick up the sources to an alternate emulation package, which +you may find in: + + /usr/src/contrib/FAQ/programs/fpu-emu + +Follow the instructions supplied. + +This is a port of an older Linux math-emulator. At some point, +FreeBSD's default math emulator will be good enough that you can +forget about having to do this. + +<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: + + FreeBSD.cdrom.com: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: + + FreeBSD.cdrom.com: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. + + + +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/contrib/FAQ/OTHER-FAQS/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: + + FreeBSD.cdrom.com:pub/FreeBSD/packages + +Second, read the file /usr/src/contrib/FAQ/OTHER-FAQS/FreeBSD.sup.faq. + +This file describes how to setup sup on your machine. You may also +want to look at /usr/src/contrib/FAQ/OTHER-FAQS/FreeBSD.*.supfile, +which are a set of supfiles for supping from freefall.cdrom.com + + +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/OTHER-FAQS/FreeBSD.kdebug.FAQ. This +file covers the instructions for looking at system dumps. + + +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 + 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 . + +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 +. Thanks! + + +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). + +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/OTHER-FAQS/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 + 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/contrib/FAQ/OTHER-FAQS/NFS 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 . 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/contrib/FAQ/OTHER-FAQS/FreeBSD.current.policy b/contrib/FAQ/OTHER-FAQS/FreeBSD.current.policy new file mode 100644 index 000000000000..cdebbc72bbbf --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.current.policy @@ -0,0 +1,162 @@ + THE FREEBSD CURRENT POLICY + +Last updated: $Date: 1994/05/07 11:39:26 $ + +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@freefall.cdrom.com' + 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 freebsd.cdrom.com. You can do this in + two ways: + + 1. Use the CMU `sup' program (Software Update Protocol). + This is the 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. + + To get a binary of the sup program for FreeBSD, as well + as the documentation and some sample configuration files, + look in: + + freefall.cdrom.com:~ftp/pub/sup + + 2. Use ftp. The source tree for FreeBSD-current is always + "exported" on: + + freebsd.cdrom.com:~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/contrib/FAQ/OTHER-FAQS/FreeBSD.kdebug.FAQ b/contrib/FAQ/OTHER-FAQS/FreeBSD.kdebug.FAQ new file mode 100644 index 000000000000..150fb8aac735 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.kdebug.FAQ @@ -0,0 +1,33 @@ + Kernel debugging FAQ + FreeBSD + +Last modified: $Id: FreeBSD.kdebug.FAQ,v 1.1 1994/06/12 15:12:21 gclarkii Exp $ + +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. + +*** Start *** + +Config you're kernel using config -g + +Remove ${STRIP} -x $@; from the Makefile for the kernel so it doesn't +get stripped. + +When the kernel's been built make a copy of it, say 386BSD.debug, and +then run strip -x on the original. Install the original as normal. + +Now, after a crash dump, go to /sys/compile/WHATEVER and run kgdb. From kgdb +do: + +symbol-file 386BSD.debug +exec-file /var/crash/system.0 +core-file /var/crash/ram.0 + +and viola, you can debug the crash dump using the kernel sources just like +you can for any other program. + + + + Paul Richards, FreeBSD core team member. + diff --git a/contrib/FAQ/OTHER-FAQS/FreeBSD.mailing-list.FAQ b/contrib/FAQ/OTHER-FAQS/FreeBSD.mailing-list.FAQ new file mode 100644 index 000000000000..f522e79f782a --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.mailing-list.FAQ @@ -0,0 +1,77 @@ + THE FREEBSD MAILING LIST FAQ + +Last updated: $Date: 1994/05/07 11:42:03 $ + +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-scsi Discussions concerning the SCSI system +freebsd-bugs Bug reports +freebsd-tz Discussions of proper timezone handling +freebsd-hackers Technical discussions and suggestions +freebsd-questions User questions +freebsd-announce Important events / milestones +freebsd-current Discussions about the use of FreeBSD-current + +----------------------------------------------------------------------------- + +Of all the lists, freebsd-arch and freebsd-admin have closed memberships +limited to a small subset of core team members and developers, though anyone +is free to send suggestions and commentary to them. The other lists may +be freely joined by anyone. + +All mailing lists live on `freefall.cdrom.com', so to post to a list you +simply mail to `@freefall.cdrom.com'. It will then be redistributed +to mailing list members throughout the world. + +To subscribe to a list, send mail to: + + majordomo@freefall.cdrom.com + +And include the keyword + + subscribe [] + +In the body of your message. For example, to subscribe yourself to +freebsd-hackers, you'd do: + + % mail majordomo@freefall.cdrom.com + 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@freefall.cdrom.com + 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@freefall.cdrom.com + 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/contrib/FAQ/OTHER-FAQS/FreeBSD.ports.supfile b/contrib/FAQ/OTHER-FAQS/FreeBSD.ports.supfile new file mode 100644 index 000000000000..60d30bfedac5 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.ports.supfile @@ -0,0 +1,18 @@ + +ports-audio release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-base release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-comm release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-db release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-devel release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-editor release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-game release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-lang release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-mail release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-math release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-net release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-news release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-print release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-shell release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-util release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress +ports-x11 release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/ports delete compress + diff --git a/contrib/FAQ/OTHER-FAQS/FreeBSD.slip.dialup.faq b/contrib/FAQ/OTHER-FAQS/FreeBSD.slip.dialup.faq new file mode 100644 index 000000000000..23734d4c8ec4 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.slip.dialup.faq @@ -0,0 +1,172 @@ +*********************************************************************** +*** How to Set Up SLIP on FreeBSD *** +*********************************************************************** + +Last updated: $Date: 1994/06/01 09:03:08 $ + $Id: FreeBSD.slip.dialup.faq,v 1.1 1994/06/01 09:03:08 asami Exp $ + +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. + +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/tty01 +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. + + If 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. + +(7) Leave the kermit there (you can suspend it by "z") and as root, + type + +slattach -h -c -s 57600 /dev/tty01 + + 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. + +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 + 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). + +--- +Satoshi Asami +asami@cs.berkeley.edu diff --git a/contrib/FAQ/OTHER-FAQS/FreeBSD.standard.supfile b/contrib/FAQ/OTHER-FAQS/FreeBSD.standard.supfile new file mode 100644 index 000000000000..531a98110b38 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.standard.supfile @@ -0,0 +1,16 @@ +base release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +bin release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +contrib release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +crypt release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +etc release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +games release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +gnu release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +include release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +ksrc release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +lib release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +libexec release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +sbin release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +share release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +usrbin release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress +usrsbin release=current host=freefall.cdrom.com hostbase=/home base=/usr prefix=/usr/src delete old compress + diff --git a/contrib/FAQ/OTHER-FAQS/FreeBSD.sup.faq b/contrib/FAQ/OTHER-FAQS/FreeBSD.sup.faq new file mode 100644 index 000000000000..35c552168d6b --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSD.sup.faq @@ -0,0 +1,98 @@ + + FreeBSD + Sup FAQ + +Last updated: $Date: 1994/05/11 22:40:48 $ + + 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_bin.tgz package from: + + freebsd.cdrom.com:~ftp/pub/FreeBSD/packages + (FreeBSD 1.1 or later) + freebsd.cdrom.com:~ftp/pub/FreeBSD/packages-1.0 + (FreeBSD 1.0.2 or earlier) + +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. There are already two files that +have been created for supping FreeBSD, both of which may be gotten from: + + freebsd.cdrom.com:~ftp/pub/FreeBSD/FAQ/OTHER-FAQS + +The file `FreeBSD.standard.supfile' is used for supping from the +/usr/src tree, the file `FreeBSD.ports.supfile' for the /usr/ports tree. +These two files can be installed whereever it is convient to do so. + + Next you will have to comment out whichever distributions you do +not wish to receive with a # at the begining of the distribution line. +You will find a list of distributions and a description for each at the +end of this file. + + 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. For more information on current please see the file: + +freefall.cdrom.com:~ftp/pub/FreeBSD/FAQ/OTHER-FAQS/FreeBSD.current.policy + +Gary Clark II +FreeBSD maintainance person + +---- + +FreeBSD SUP distributions + +From FreeBSD.standard.supfile: + +base: Just those files at the top of /usr/src. +bin: /bin +contrib: Sources to programs located in /usr/src/contrib, including the FAQ. +crypt: Sources to libcrypt. NOTE: This is for use by US and Canadians only!! +etc: /etc +games: /usr/games +gnu: Software that is under the GPL, like gcc, groff and uucp. +include: /usr/include +ksrc: The kernel sources +lib: /usr/lib +libexec: /usr/libexec +sbin: /sbin +usrbin: /usr/bin +usrsbin: /usr/sbin + +From FreeBSD.ports.supfile + +ports-audio: Audio applications +ports-base: Just those files at the top of /usr/ports. +ports-comm: Communications software +ports-db: Database software +ports-devel: Development software +ports-editor: Editing software +ports-game: Game software +ports-lang: Programming Languages +ports-mail: Mail software +ports-math: Math software +ports-net: Network software +ports-news: USENET news software +ports-print: Printing software +ports-shell: User shell software +ports-util: Utility software +ports-x11: X11 software diff --git a/contrib/FAQ/OTHER-FAQS/FreeBSDvsLinux b/contrib/FAQ/OTHER-FAQS/FreeBSDvsLinux new file mode 100644 index 000000000000..c282475d60e5 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/FreeBSDvsLinux @@ -0,0 +1,70 @@ +[ Note: You could very well simply substitute the word "NetBSD" for Linux + in the argument that follows ] + +From time to time, a thread in both the comp.os.386bsd.misc and +comp.os.linux.misc groups flares up regarding which operating system is +"better", FreeBSD or Linux. This generally provokes controversy from +users on both sides, with one group claiming that their OS is "better" +for some reason and the other group claiming that the first group +doesn't know what the heck it's talking about. + +Both arguments are a waste of time. + +Rather than trying to win a rather questionable debate on relative +(and constantly changing) technical merits, we should be asking ourselves +what both groups are REALLY about and what they represent. This is +naturally going to be a matter of personal opinion, but I believe even the +most seriously at-odds members would agree that both operating systems +represent a unique and long-awaited opportunity: The ability to run a +fully featured operating system on popular, easily affordable hardware +and for which all source code is freely available. + +Those who have been in computing for awhile will remember when the term +`operating system' referred almost exclusively to something provided solely +by the hardware vendor, with very little in the way of alternative options. +It was never EVER given out with source code, and true "wizard" status could +only be achieved by exerting mind-numbing amounts of effort and patience in +digging through forbidden bits of binary data. By comparison, the situation +today seems almost too good to be true! Certainly, the feeling of achievement +that came from finally ferreting out some esoteric bit of information from +a 4MB printed system dump was high, but I don't think that anyone would argue +that it was hardly the most optimal way of truly getting to know your +operating system! :-) + +So now, within a very short space of time, we're almost spoiled for choice in +having machines several times more powerful than the first multi-user VAX +machines and available for under $2000, and we've got not one but SEVERAL +perfectly reasonable free operating systems to chose from. We are in a +comparative paradise, and what are some of us doing? *Complaining* about it! +I suppose too much is never enough, eh? :-) + +So, my essential point is simply this: For the first time ever we +have what previous computing generations could only dream about; +powerful computers at a reasonable prices and a wonderful selection of +things to run on them. Be happy, read the source code you're so +privileged to now have available (*believe* me! What I wouldn't have +given, even 5 years ago!) and spend your energy in making constructive +use of it, not in arguing with the guys on the other side of the +fence! + +Additionally, it should be said that none of the FreeBSD team has +anything but the highest degree of respect for Linus Torvalds and his +"team" of dedicated volunteers (and we occasional exchange gripe mail +about the huge volume of messages each of us gets as a direct result +of being insane enough to volunteer to do something like this :-). +Our common commitment to the Intel platform also gives us more common +ground (and interests) than one might think and, if anything, it's a pity +that we do not endevor to share more code and effort - ideologically, +at least, I'd say we share pretty similar goals. + +As to which is "best", I have only one standard reply: Try them both, +see for yourself, think for yourself. Both groups have given you +something for free, at considerable personal effort, and the least you +can do is give them the benefit of exerting enough effort to try what +they're offering out before passing judgment (or worse, blindly +accepting someone else's!). + +Whichever you run, you're getting a great deal - enjoy! + + + Jordan Hubbard diff --git a/contrib/FAQ/OTHER-FAQS/NFS b/contrib/FAQ/OTHER-FAQS/NFS new file mode 100644 index 000000000000..e6f7af8fc511 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/NFS @@ -0,0 +1,77 @@ +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/contrib/FAQ/OTHER-FAQS/Systems.FAQ b/contrib/FAQ/OTHER-FAQS/Systems.FAQ new file mode 100644 index 000000000000..c2e3e2ed5177 --- /dev/null +++ b/contrib/FAQ/OTHER-FAQS/Systems.FAQ @@ -0,0 +1,266 @@ + Systems FAQ + For FreeBSD + Last Modified: $Id: Systems.FAQ,v 1.1 1994/06/11 17:59:19 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/contrib/FAQ/code/printcap01/Makefile b/contrib/FAQ/code/printcap01/Makefile new file mode 100644 index 000000000000..fda6ebb83586 --- /dev/null +++ b/contrib/FAQ/code/printcap01/Makefile @@ -0,0 +1,22 @@ +# +# Makefile for the FAQ/printcap +# + +PROG = hpf +SRCS = hpf.c + + +install: + if test -d /usr/libexec/lpr; \ + then \ + true; \ + else \ + mkdir /usr/libexec/lpr; + fi; + + install -c -o bin -g bin -m 555 hpf /usr/libexec/lpr + install -c -o bin -g bin -m 555 ps2lj3 /usr/libexec/lpr + install -c -o bin -g bin -m 555 printcap.sample /etc/printcap + +.include + diff --git a/contrib/FAQ/code/printcap01/README b/contrib/FAQ/code/printcap01/README new file mode 100644 index 000000000000..c13eb72ddb65 --- /dev/null +++ b/contrib/FAQ/code/printcap01/README @@ -0,0 +1,14 @@ +This print cap package was created by Curt Mayer. Please contact hime for more +information. + +Curt Mayer +curt@toad.com +415-387-0217 home + +To install this package, type make then make install. This will copy the +printcap.sample to /etc/printcap and create the directory /usr/libexec/lpr +and copy the hpf filter to there. + +Thanks +Gary Clark II +FreeBSD FAQ Person diff --git a/contrib/FAQ/code/printcap01/hpf.c b/contrib/FAQ/code/printcap01/hpf.c new file mode 100644 index 000000000000..8d78c092f902 --- /dev/null +++ b/contrib/FAQ/code/printcap01/hpf.c @@ -0,0 +1,38 @@ +/* +source to my hp filter, installed as /usr/libexec/lpr/hpf: +*/ +#include "stdio.h" +#include +#include +#include +#include + +main(ac, av) +int ac; +char **av; +{ + int c; + struct sgttyb nbuf; + unsigned long lbits; + + setbuf(stdout, NULL); + lbits = LDECCTQ | LPASS8 | LLITOUT; + ioctl(fileno(stdout), TIOCLSET, &lbits); + ioctl(fileno(stdout), TIOCGETP, &nbuf); + nbuf.sg_flags &= ~(ECHO | XTABS | CRMOD); + ioctl(fileno(stdout), TIOCSETP, &nbuf); + + fputs("\033E\033&k2G", stdout); + + while (1) { + if ((c = getchar()) != EOF) { + putchar(c); + } else { + break; + } + } + + fputs("\033&l0H", stdout); + + exit(0); +} diff --git a/contrib/FAQ/code/printcap01/printcap.sample b/contrib/FAQ/code/printcap01/printcap.sample new file mode 100644 index 000000000000..10e87ba2d386 --- /dev/null +++ b/contrib/FAQ/code/printcap01/printcap.sample @@ -0,0 +1,9 @@ + +ps|postscript emulation:\ + :lp=/dev/lpa0:sd=/var/spool/lpd:lf=/var/log/lpd-errs:\ + :if=/usr/libexec/lpr/ps2lj3:sh:mx#0:sf: + +lp|epson|lj|local line printer:\ + :lp=/dev/lpa0:sd=/var/spool/lpd:lf=/var/log/lpd-errs:\ + :if=/usr/libexec/lpr/hpf:\ + :sh:mx#0:pw#80: diff --git a/contrib/FAQ/code/printcap01/ps2lj3 b/contrib/FAQ/code/printcap01/ps2lj3 new file mode 100644 index 000000000000..8dc9ff384011 --- /dev/null +++ b/contrib/FAQ/code/printcap01/ps2lj3 @@ -0,0 +1,4 @@ + +#!/bin/sh +/usr/gnu/bin/gs -dNOPAUSE -r300 -q -sDEVICE=ljet3 -sOutputFile=- -f - + diff --git a/contrib/Makefile b/contrib/Makefile index c1625896c8f4..24d96987e809 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -1,6 +1,6 @@ -# $Id: Makefile,v 1.3 1993/12/21 21:18:14 wollman Exp $ +# $Id: Makefile,v 1.5 1994/06/15 21:08:47 jkh Exp $ -SUBDIR= tcpdump xntpd +SUBDIR= crunch manctl tcpdump xntpd # Not ported: isode diff --git a/contrib/adduser/AddIt b/contrib/adduser/AddIt new file mode 100755 index 000000000000..64f6f945013b --- /dev/null +++ b/contrib/adduser/AddIt @@ -0,0 +1,249 @@ +#!/usr/local/bin/perl + +# Copyright (c) 1994 GB Data Consulting +# All rights reserved. +# VERSION 0.8 BETA +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce 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. +# 4. This license extends only to beta and network distributed versions. +# All even number versions are non-network. +# 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. + +# You will need to define these if you wish to have defaults or use +# that function. + +$defgroupid = 30; # Default ID +$defusrdir = "\/usr\/u"; # Default User Dir +$usequota = ""; # Use quotas +$usemail = ""; # Use mailings +$mailfile = ""; # File to use with mailings +$userdefshell = "\/bin\/csh"; # Default user shell +$useforward = ""; # Use a forward file +$protouser= ""; # Prototypical user for quotas + +# Start getting information and print a banner + +print " AddIt\n"; +print " A system utility for adding users with defaults\n"; +print " Copyright 1994 GB Data Consulting\n"; +print "\n\n"; + +# +# User ID +# + +print "Please enter the login name of the user: "; +chop ($userlogin = ); +print "Please enter the user id or hit enter for the next id: "; +chop ($userid = ); + +if (!$userid) { + open (USERID, "+); + $userid = $xxuserid + 1; + close USERID; + open (USERID, "+>userids"); + print (USERID "$userid\n"); + close USERID; + } + +# +# Group ID +# + +print "Please enter the group id or hit enter for the default id: "; +chop ($groupid = ); + +if (!$groupid) { +$groupid = "$defgroupid"; +} + +# +# User name +# + +print "Please enter the user's name: "; +chop ($username = ); + +# +# Home directory +# + +print "Please enter the users home directory or hit enter for default: "; +chop ($userdir = ); + +if (!$userdir) { + $userdir = "$defusrdir\/$userlogin"; + print "$userdir\n"; +} + +# +# Login Shell +# + +print "Please enter the users login shell or hit enter for default: "; +chop ($usershell = ); + +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) + { + print "$defusrdir does not exist, exiting!\n"; + exit; + } +system "mkdir $userdir"; +if (! -e $userdir) + { + print "$userdir does not exist!!\n"; + print "This may be due to a parent dir not being there...\n"; + exit; + } + +print "Copying user shell files\n"; +system "cp dot.login $userdir\/\.login"; +system "cp dot.profile $userdir\/\.profile"; + +if ($usershell eq "\/bin\/csh" || $usershell eq "\/usr\/local\/bin\/tcsh") + { + system "cp dot.cshrc $userdir\/.cshrc"; + } +system "chmod -R 654 $userdir"; +system "chown -R $userid.$groupid $userdir"; + +# +# Mailings +# +if ($usemail) + { + print "Mailing new user notice\n"; + system "elm \-s \"New User Mailing\" $userid $mailfile"; + } + +# +# Quotas +# +if ($usequota) + { + print "Editing quotas for user $userlogin\n"; + if ($protouser) { + system "edquota -u -p $protouser $userlogin"; + } else { + system "edquota -u $userlogin"; + } +} + +# +# Forward files +# +if ($useforward) + { + print "Please enter the name of the account to forward to:"; + chop ($account = ); + if (!$account) + { + $acc = $defaccount; + } + else + { + $acc = $account; + } + print "Please enter the name of the system to forward to:"; + chop ($system = ); + if (!$system) + { + $sys = $defsystem; + } + else + { + $sys = $system; + } + print "Creating \.forward file for user $userlogin\n"; + open (FORWARD, ">$userdir\/\.forward"); + print (FORWARD "$acc@$sys\n"); + close FORWARD; + system "chown $userid\.$groupid $userdir\/\.forward"; +} + +# +# 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"; +if ($usemail) + { + $mailyn = "Using mailing"; + } +else + { + $mailyn = "Not using mailing"; + } +print "Mailing: $mailyn\n"; +if ($usequota) + { + $quotayn = "Using quotas"; + } +else + { + $quotayn = "Not using quotas"; + } +print "Quotas: $quotayn\n"; +if ($useforward) + { + $forwardyn = "forwarded to $acc@$sys"; + } +else + { + $forwardyn = "Not using forward file"; + } +print "ForwardFile: $forwardyn\n"; +print "\nDONE\n\n"; + + + diff --git a/contrib/adduser/README b/contrib/adduser/README new file mode 100644 index 000000000000..7ac1013e3f00 --- /dev/null +++ b/contrib/adduser/README @@ -0,0 +1,40 @@ + AddIt + Version 0.8-Beta + + +This is the README file for AddIt version 0.8Beta. AddIt is a +perl script that is intended to make adding a user to the system simple +and easy. Installation and use are very easy and directions follow. + +1. Un-tar the distribution on your system. It must have its own directory + due to other files it uses. +2. Use vi to edit the userids file if your planning on using the auto id + option of the system. Make the userid one lower than what you want + to start at. +3. Edit AddIt itself to configure the following options for use with the + system. + + A. $defgroupid: This is the default group id the system will use. + B. $defusrdir: This is the default place for the system to create + user directories and copy needed files. + C. $usequota: Define this variable if you wish to use quotas on your + system. Make sure that you have a kernel that has this defined. + D. $usemail: Define this variable if you wish to have a flyer + mailed to the user after account creation. + E. $usedefshell: Define this to be the default shell on your system. + F. $useforward: Define this variable if you wish to have .forward + files created for use on the system. + G. $protouser: Define this variable to be the proto user for use with + quotas. + H. $mailfile: This is the file to mail to a new user when $usemail is + defined. + +5. Make sure that the default user directory ($defusrdir) exists. +6. Run AddIt. The program will ask you questions about the user and + automaticly create their directory, copy startup files and then + do other things depending on how you have the system configured. + + +As normal sugestions and bug reports to bugs@radon.gbdata.com. + + diff --git a/contrib/adduser/dot.cshrc b/contrib/adduser/dot.cshrc new file mode 100644 index 000000000000..d1e8a36ee1e4 --- /dev/null +++ b/contrib/adduser/dot.cshrc @@ -0,0 +1,27 @@ +# .cshrc initialization + +alias df df -k +alias du du -k +alias f finger +alias h 'history -r | more' +alias j jobs -l +alias la ls -a +alias lf ls -FA +alias ll ls -lgsA +alias su su -m +alias tset 'set noglob histchars=""; eval `\tset -s \!*`; unset noglob histchars' +alias x exit +alias z suspend + +set path = (~/bin /bin /usr/{bin,new,games,local,old} .) + +if ($?prompt) then + # An interactive shell -- set some stuff up + set filec + set history = 1000 + set ignoreeof + set mail = (/var/mail/$USER) + set mch = `hostname -s` + set prompt = "$mch:q:$cwd:t {\!} " + umask 2 +endif diff --git a/contrib/adduser/dot.login b/contrib/adduser/dot.login new file mode 100644 index 000000000000..bdbc7506830f --- /dev/null +++ b/contrib/adduser/dot.login @@ -0,0 +1,15 @@ +#csh login file + +if ( ! $?TERMCAP ) then + tset -Q '-mdialup:?vt100' $TERM +endif + +stty newcrt crterase + +set savehist=100 +set ignoreeof + +setenv EXINIT 'set ai sm noeb' +setenv HOSTALIASES $HOME/.hostaliases + +/usr/games/fortune diff --git a/contrib/adduser/dot.profile b/contrib/adduser/dot.profile new file mode 100644 index 000000000000..95ed15cdc5ba --- /dev/null +++ b/contrib/adduser/dot.profile @@ -0,0 +1,2 @@ +PATH=/bin:/usr/bin:/usr/new:/usr/local:/usr/games:/usr/old:. +export PATH HOME TERM diff --git a/contrib/adduser/userids b/contrib/adduser/userids new file mode 100644 index 000000000000..2bc4cd64b870 --- /dev/null +++ b/contrib/adduser/userids @@ -0,0 +1 @@ +510 diff --git a/contrib/configit/ConfigIt b/contrib/configit/ConfigIt new file mode 100755 index 000000000000..0899cba4faad --- /dev/null +++ b/contrib/configit/ConfigIt @@ -0,0 +1,761 @@ +#!/usr/bin/perl +# +# Copyright (c) 1994 GB Data Consulting +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce 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. +# 4. This license extends only to network distributed versions. +# All even number versions are non-network. +# 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: ConfigIt,v 1.2 1994/05/02 06:57:47 gclarkii Exp $ +# + +&config; +&standard_devices; +&menu; + +sub menu { +system "clear"; + +print " ConfigIt!\n"; +print " A auto-configuration system\n"; +print "\n\n\n"; + +print " 1 Disk devices\n"; +print " 2 Serial devices\n"; +print " 3 Network devices\n"; +print " 4 Console devices\n"; +print " 5 Tape devices\n"; +print " 6 Misc devices and options\n"; +print " 7 Parallel devices\n"; +print "\n\n"; +print "Please enter you choice or q to quit: "; +chop ($choice = ); + +if ($choice eq ('q' || 'Q')) + { + print (CONFIG "\n\n\n"); + close CONFIG; + exit; } + elsif ($choice == 1) + { &disk_devices; } + elsif ($choice == 2 && !$serdevsflag) + { &serial_devices; } + elsif ($choice == 3 && !$netdevsflag) + { &network_devices; } + elsif ($choice == 4) + { &console_devices; } + elsif ($choice == 5) + { &tape_devices; } + elsif ($choice == 6) + { &misc_dev_option; } + elsif ($choice == 7) + { ¶llel_ports; } + else + { &menu; } +&menu; + +} + + +sub config { +system "clear"; +print " ConfigIt!\n"; +print " A Auto-configuration System\n\n"; +print "Please enter the name of your system: "; +chop ($systemname = ); +$systemname =~ tr/a-z/A-Z/; +open (CONFIG, ">>$systemname"); + +} + + +sub config_serial_devices { +print (CONFIG "\n#Multi-port Config\n"); +print "Multi-port Comm-Cards are not supported at this time....\n\n"; +sleep 3; + +} + + +sub console_devices { +system "clear"; +print " Console Devices\n\n"; +print " 1 Syscons\n"; +print " 2 Pccons\n"; +print "\n\n\n"; +print "Please enter your choice (q or Q to quit): "; +chop ($cdevs = ); + +if ($cdevs == 1 && !$condevsflag) + { &syscons; } +elsif ($cdevs == 2 && !$condevsflag) + { &pccons; } +elsif ($cdevs eq 'q') + { return; } +elsif ($cdevs eq 'Q') + { return; } +else { + &console_devices; } +} + + + +sub disk_devices { + + system "clear"; + local ($choice); + print " Disk Device Sub-section\n\n"; + print " 1 WD drives\n"; + print " 2 SCSI drives\n"; + print " 3 Floppy & QIC-40/80 Drives\n"; + print " 4 Mitsumi CD-ROM Drive\n"; + print "\n\n"; + print "Please enter your choice: "; + chop ($choice = ); + + if ($choice eq ('q' || 'Q')) + { return; } + elsif ($choice == 1 && !$wdflag) + { &wd_drives; } + elsif ($choice == 2 && !$scsidevflag) + { &scsi_drives; } + elsif ($choice == 3 && !$floppyflag) + { &floppy_drives; } + elsif ($choice == 4 && !$mitsumiflag) + { &mitsumi_drive; } + else + { &disk_devices; } +} + + +sub doonecard { +$cardnum = @_[0]; + +system "clear"; +print " 1 AT&T EN100/STARLAN 10\n"; +print " 2 ISOLAN AT 4141-0\n or ISOLINK 4110\n"; +print " 3 WD/SMC 8003 & 8013\n"; +print " 4 SMC Ultra Elite 16\n"; +print " 5 3com 3c503\n"; +print " 6 NE1000/NE2000\n"; +print "\n\nPlease enter the type of network card number $cardnum : "; +chop ($netcardchoice = ); +print "Please enter the port (in hex) address of the card: "; +chop ($netcardadd = ); +print "Please enter the irq of the card: "; +chop ($netcardirq = ); + +if ($netcardchoice != 2) + { print "Please enter the I/O mem of the card: "; + chop ($netcardiomem = ); + } + +if ($netcardchoice != (2 || 1)) + { + if ($ednum < 1) { + $cardty = 'ed0'; + $ednum++; + } else { + $cardty = "ed$ednum"; + $ednum++; + } + $interp = 'edintr'; + } + +if ($netcardchoice == 2) + { + if ($isnum < 1) { + $cardty = 'is0'; + $isnum++; + } else { + $cardty = "is$isnum"; + $isnum++; + } + $interp = 'isintr'; + } + +if ($netcardchoice == 1) + { + if ($ienum < 1) { + $cardty = 'ie0'; + $ienum++; + } else { + $cardty = "ie$ienum"; + $ienum++ + } + $interp = 'ieintr'; + } + +print (CONFIG "device $cardty at isa? port $netcardadd net irq $netcardirq iomem $netcardiomem vector $interp\n"); + +} + + +sub floppy_drives +{ +$floppyflag = 1; +system "clear"; +print (CONFIG "\n#Disk devices\n\n"); + +print "How many floppys do you have?: "; +chop ($flch = ); +if ($flch > 0) + { + print (CONFIG "controller fdc0 at isa? port \"IO_FD1\" bio irq 6 drq 2 vector fdintr\n"); + print (CONFIG "disk fd0 at fdc0 drive 0\n"); + print (CONFIG "disk fd1 at fdc0 drive 1\n"); + } +if ($flch > 0) + { + print "Do you have a QIC-40/80 drive?: "; + chop ($qic40 = ); + if ($qic40 eq 'y' || $qic40 eq 'Y') + { + print (CONFIG "tape ft0 at fdc0 drive 2\n"); + } + } +} + + +sub misc_dev_option { +system "clear"; +$miscdevflag = 1; +print (CONFIG "\n# Misc Devices\n"); +print "Do you want kernel tracing?: "; +chop ($ktrace = ); +if ($ktrace eq ('y' || 'Y')) + { + print (CONFIG "options KTRACE\n"); + } +print "Do you want kernel debugging?: "; +chop ($kddb = ); +if ($kddb eq ('y' || 'Y')) + { + print (CONFIG "pseudo-device ddb\n"); + } +print "Do you want fast symlinks?: "; +chop ($fastlinks = ); +if ($fastlinks eq ('y' || 'Y')) + { + print (CONFIG "options FASTLINKS\n"); + } +print "Do you want PC file system support?: "; +chop ($pcfs = ); +if ($pcfs eq ('y' || 'Y')) + { + print (CONFIG "options PCFS\n"); + } +print "Do you want Memory File System support?: "; +chop ($mfs = ); +if ($mfs eq ('y' || 'Y')) + { + print (CONFIG "options MFS\n"); + } +print "Do you want QUOTA support?: "; +chop ($quota = ); +if ($quota eq ('y' || 'Y')) + { + print (CONFIG "options QUOTA\n"); + } +print "Do you want FIFO support?: "; +chop ($fifo = ); +if ($fifo eq ('y' || 'Y')) + { + print (CONFIG "options FIFO\n"); + } +print "Do you want ISO File System support?: "; +chop ($isofs = ); +if ($isofs eq ('y' || 'Y')) + { + print (CONFIG "options ISOFS\n"); + } + +} + + +sub mitsumi_drive { +system "clear"; +$mitsumiflag = 1; +print (CONFIG "\n#Disk devices\n\n"); + +print "What address (hex) is the mitsumi controller at?: "; +chop ($mitadd = ); +print "What interupt is the mitsumi controller at?: "; +chop ($mitint = ); +print (CONFIG "device mcd at isa? port $mitadd bio irq $mitint vector mcdint\n"); +} + +# +# Multi-port support for serial_devices.pl +# +# $Id: ConfigIt,v 1.2 1994/05/02 06:57:47 gclarkii Exp $ +# + + +sub multiport { +$numstandm = @_[0]; +system "clear"; +print "NOTE: Only 1 multiport card is supported by ConfigIt.\n"; +print "Please enter the number of ports on the card: "; + chop ($multinum = ); +print "Please enter the starting port of the card: "; + chop ($startm = ); +print "Please enter the port number of the master port or 0 if none: "; + chop ($multimaster = ); +print "Please enter the intrupt of the card: "; + chop ($multiint = ); +print (CONFIG "\n#Multi-port serial devices\n\n"); +print (CONFIG "options \"COM_MULTIPORT\"\n"); + +$portm = $startm; +$startm =~ tr/a-z/A-Z/; + + for ($i = 1; $i < $multinum + 1; $i++) { + $siom = $i + $numstandm; + $siom = $siom - 1; + if ($siom < 10) { $sio = "sio0"; } else { $sio = "sio"; } + + if ($multimaster != $i) { + print (CONFIG "device $sio$siom at isa? port $portm flags 0x501 vector siointr\n"); + } else { + print (CONFIG "device $sio$siom at isa? port $portm tty irq $multiint flags 0x501 vector siointr\n"); + } +$portm =~ tr/A-Z/a-z/; +$numorig = hex ("$portm"); +$numadd = hex ("0x08"); +$numend = $numadd + $numorig; +$endm = sprintf ("%lx", $numend); +$end1m = $endm; +$portm = "0x$end1m"; +$portm =~ tr/a-z/A-Z/; + + } +if ($numstandm > 0) { &standard_serial; } +} + +sub network_devices { +system "clear"; +$netdevsflag = 1; +print (CONFIG "\n# Network devices\n"); +print "How many networking cards do you have: "; +chop ($numnet = ); + +if ($numnet != 0) { +for ($i = 1; $i <= $numnet ; $i++) +{ + &doonecard($i); + } +} + +print "Do you need the SLIP device in the kernel?: "; +chop ($slipch = ); +if ($slipch eq ('y' || 'Y')) + { + print "How many slip devices do you need: "; + chop ($slipno = ); + print (CONFIG "pseudo-device slip $slipno\n"); + } + +print "Do you need the PPP device in the kernel?: "; +chop ($pppch = ); +if ($pppch eq ('y' || 'Y')) + { + print "How many PPP devices do you need: "; + chop ($pppno = ); + print (CONFIG "pseudo-device ppp $pppno\n"); + } + +print "Do you want Berkeley Packet Filter support?: "; +chop ($bpf = ); +if ($bpf eq ('y' || 'Y')) + { + print (CONFIG "pseudo-device bpf\n"); + } + +print "Do you want Internetwork Gateway support?: "; +chop ($gateway = ); +if ($gateway eq ('y' || 'Y')) + { + print (CONFIG "option GATEWAY\n"); + } + +print "Do you want NFS support?: "; +chop ($nfs = ); +if ($nfs eq ('y' || 'Y')) + { + print (CONFIG "option NFS\n"); + } + +print "How many pty's do you want?: "; +chop ($ptyno = ); +if ($ptyno eq ('y' || 'Y')) + { + print (CONFIG "pseudo-device pty $ptyno\n"); + } + +} + + +# +# +# + +sub parallel_ports { + +print "How many parallel ports do you have: "; + chop ($paranum = ); + +if ($paranum) { +print (CONFIG "\n#Parallel devices\n\n"); + +for ($i = 1; $i <= $paranum; $i++) { + $lpanum = $i - 1; + print "Please enter the address for parallel port number $i : "; + chop ($paraport = ); + print "If you are running with out interupts on this port please\n"; + print "anwser 0 to the following question.\n"; + print "Please enter the interupt for parallel port number $i : "; + chop ($paraint = ); + if ($paraint) { + print (CONFIG "device lpa$lpanum at isa? port $paraport tty irq $paraint vector lptintr\n"); + } else { + print (CONFIG "device lpa$lpanum at isa? port $paraport tty vector lptintr\n"); + } + + } + + } + +} + +sub pccons { +$condevsflag = 1; +print (CONFIG "\n# Console devices\n\n"); +print (CONFIG "device pc0 at isa? port \"IO_KBD\" tty irq 1 vector pcrint\n"); + +} + + +sub scsi_drives { +$scsidevsflag = 1; +system "clear"; +print (CONFIG "\n# SCSI Devices\n\n"); +print " 1 Adaptec 1542/Bustec 542\n"; +print " 2 Adaptec 1742\n"; +print " 3 Bustec 742\n"; +print " 4 Ultrastore 14F/34F\n"; +print "\n\n"; +print "Enter your choice or q to quit: "; +chop ($scsicho = ); + +if ($scsicho eq 'q' || $scsicho eq 'Q') + { + return; + } +elsif ($scsicho == 1) + { + $scsicard = "aha0"; + $scsiio = "\"IO_AHA0\""; + $scsiint = "ahaintr"; + } +elsif ($scsicho == 2) + { + $scsicard = "ahb0"; + $scsiint = "ahbintr"; + } +elsif ($scsicho == 3) + { + $scsicard = "bt0"; + $scsiio = "\"IO_BT0\""; + $scsiint = "btintr"; + } +elsif ($scsicho == 4) + { + $scsicard = "uha0"; + $scsiio = "\"IO_UHA0\""; + $scsiio = "uhaintr"; + } +else { &scsi_drives; } + +if ($scsicho == 2) + { + print "Please enter the interupt the AHA-1742 is on: "; + chop ($scsiirq = ); + print (CONFIG "contoller ahb0 at isa? bio irq $scsiirq vector $scsiint\n"); + } +elsif ($scsicho == 1 || $scsicho == 4) + { + print "Please enter the interupt the SCSI controller is on: "; + chop ($scsiirq = ); + print "Please enter the dma channel the SCSI controller is on: "; + chop ($scsidrq = ); + print (CONFIG "controller $scsicard at isa? port $scsiio bio irq $scsiirq drq $scsidrq vector $scsiint\n"); + } +else + { + print "Please enter the interupt the SCSI controller is on: "; + chop ($scsiirq = ); + print (CONFIG "controller $scsicard at isa? port $scsiio bio irq $scsiirq vector $scsiint\n"); + } + +print (CONFIG "device sd0\n"); +print (CONFIG "device sd1\n"); +print (CONFIG "device sd2\n"); +print (CONFIG "device sd3\n"); +print (CONFIG "device st1\n"); +print (CONFIG "device st2\n"); +print (CONFIG "device cd0\n"); + +} + +# +# Do serial ports, only standard ones are here +# +# + +sub serial_devices { +system "clear"; +$serdevsflag = 1; + +print "Do you have a multi-port card (Non-standard serial card): "; + chop ($multicard = ); +print "Please enter the number of standard serial ports you have: "; + chop ($numstand = ); + + if ($multicard eq ( 'y' || 'Y')) { + print "Please enter the number of standard serial ports you also have: "; + &multiport($numstand); + } else { + &standard_serial($numstand); + } +print "Do you wish to have bidirectionl serial ports: "; + chop ($bidir = ); + if ($bidir eq ('y' || 'Y')) { + print (CONFIG "options \"COM_BIDIR\"\n"); + } +} + + +sub standard_devices { +system "clear"; +print "What timezone are you in? (cst = 6): "; +chop ($time = ); +print "What type of cpu do you have? ( 386 or 486 ): "; +chop ($cputype = ); + +if ($cputype == 386) + { + print "Do you have a 387?: "; + chop ($mathco = ); + } + +if ($cputype == 486) + { + print "Is it a DX or SX?: "; + chop ($dxsx = ); + if ($dxsz eq 'SX' || $dxsx eq 'sx') + { + $mathco = 'n'; + } + } + +chop ($date = `date`); +chop ($whoami = `whoami`); + +print (CONFIG "\n#\n#Config file for $systemname\n"); +print (CONFIG "#Generated by ConfigIt!\n"); +print (CONFIG "#Generated at $date by $whoami\n#\n#\n\n"); + +print (CONFIG "#Generic Items\n\n"); +print (CONFIG "machine \"i386\"\n"); +print (CONFIG "cpu \"I","$cputype","_CPU\"\n"); + +if ($mathco eq 'n' || $mathco eq 'N') + { + print "Do you wish to use the new math emulator (its better): "; + chop ($choicesti = ); + if ($choicesti eq ('y' || 'Y')) { + print (CONFIG "options GPL_MATH_EMULATE\n"); + } else { + print (CONFIG "options MATH_EMULATE\n"); + } +} + +print "The following is used to set certain parameters.\n"; +print "Please enter the number of users you expect: "; + chop ($maxusers = ); +if ($maxusers <= 10) { $maxusers = 10; } +print (CONFIG "ident $systemname\n"); +print (CONFIG "maxusers $maxusers\n"); +print (CONFIG "maxfdescs 2000\n"); +print (CONFIG "timezone $time dst\n"); +print (CONFIG "options \"COMPAT_43\"\n"); +print (CONFIG "options UCONSOLE\n"); +print (CONFIG "options XSERVER\n"); +print (CONFIG "options INET\n"); +print "What device is root on? (e.g. \"wd0\"): "; +chop ($root = ); +if ($root) { +$roots = "root on $root"; +} else { print "ABORTING you must have a root!\n"; exit; } + +print "What device is swap on? (e.g. \"wd0\" or \"wd0 and wd1\"): "; +chop ($swap = ); +if ($swap) { +$swaps = "swap on $swap"; +} +print "What device is dump on? (e.g. \"wd0\"): "; +chop ($dump = ); +if ($dumps) { +$dumps = "dumps on $dump"; +} + +print (CONFIG "config \"386bsd\" $roots $swaps $dumps \n"); +print (CONFIG "pseudo-device vnodepager\n"); +print (CONFIG "pseudo-device swappager\n"); +print (CONFIG "pseudo-device devpager\n"); +print (CONFIG "pseudo-device ether\n"); +print (CONFIG "pseudo-device loop\n"); +print (CONFIG "pseudo-device log\n"); +print (CONFIG "pseudo-device speaker\n"); +print (CONFIG "device isa0\n"); + +} + + +# +# Do standard serial ports +# + +sub standard_serial { +$sernumss = @_[0]; + + print "Are the $sernumss standard ports at the standard location and interup: "; + chop ($standss = ); +if ($standss eq ('y' || 'Y')) { + + if ($sernumss == 0 || $sernumss > 4) + { print "invalid number of serial ports!!\n\n"; + print "Please hit any key to continue."; + while (!($kbhit = )) {} + &serial_devices;} + + if ($sernumss < 3) { + print (CONFIG "\n#Standard serial devices\n\n"); + print (CONFIG "device sio00 at isa? port \"IO_COM1\" tty irq 4 vector siointr\n"); + print (CONFIG "device sio01 at isa? port \"IO_COM2\" tty irq 3 vector siointr\n"); + } else { + print (CONFIG "\n#Standard serial devices\n\n"); + print (CONFIG "device sio00 at isa? port \"IO_COM1\" tty irq 4 vector siointr\n"); + print (CONFIG "device sio01 at isa? port \"IO_COM2\" tty irq 3 vector siointr\n"); + print (CONFIG "device sio02 at isa? port \"IO_COM3\" tty irq 5 vector siointr\n"); + print (CONFIG "device sio03 at isa? port \"IO_COM4\" tty irq 9 vector siointr\n"); } + +} else { + print (CONFIG "\n#Standard serial devices\n\n"); + + for ($i = 1;$i <= $sernum;$i++) { + print "Please enter the intrupt for serial port number $i: "; + chop ($intt = ); + print "Please enter the address for serial port number $i: "; + chop ($portk = ); + $iik = $i - 1; + print (CONFIG "device sio0$iik at isa port $portk tty irq $intt vector siointr\n"); + + } + } +} + + + +sub syscons { +print (CONFIG "\n#Console device\n"); + +$condevsflag = 1; +system "clear"; +print (CONFIG "device sc0 at isa? port \"IO_KBD\" tty irq 1 vector scintr\n"); +print "How many virtual terminals do you want? (max 8): "; +chop ($numvty = ); +if ($numvty == 0 || $numvty > 8) + { $numvty = 1; } +print (CONFIG "options \"NCONS=$numvty\"\n"); +print (CONFIG "options \"STAR_SAVER\"\n"); +print (CONFIG "options \"FADE_SAVER\"\n"); +print (CONFIG "options \"SNAKE_SAVER\"\n"); +print (CONFIG "options \"BLANK_SAVER\"\n"); + +} + + +sub tape_devices +{ +system "clear"; +print (CONFIG "\n# QIC-02 Tape devices\n\n"); +$tapdevsflag = 1; +print "Do you have a QIC-02 tape drive?: "; +chop ($qic02 = ); +if ($qic02 eq ('y' || 'Y')) + { +print "What address is it at? (Hex): "; +chop ($qic02add = ); +print "What interupt is it at?: "; +chop ($qic02int = ); +print (CONFIG "device wt0 at isa? port $qic02add bio irq $qic02int drq 1 vector wtintr\n"); + } +} + + +sub wd_drives { + $wdflag = 1; + local ($choice); + system "clear"; + print (CONFIG "\n#Disk devices\n\n"); + + print " WD Drive Configuration\n\n"; + print "How many WD drives do you have (Max of 4): "; + chop ($choice = ); + + if ($choice >= 3 ) { + print "\n"; + print (CONFIG "controller wdc0 at isa? port \"IO_WD1\" bio irq 14 vector wdintr\n"); + print "\n"; + print (CONFIG "disk wd0 at wdc0 drive 0\n"); + print (CONFIG "disk wd1 at wdc1 drive 1\n"); + print (CONFIG "controller wdc1 at isa? port \"IO_WD2\" bio irq 15 vector wdintr\n"); + print (CONFIG "disk wd2 at wdc1 drive 0\n"); + print (CONFIG "disk wd3 at wdc1 drive 1\n"); + print "\n"; + } else { + print "\n"; + print (CONFIG "controller wdc0 at isa? port \"IO_WD1\" bio irq 14 vector wdintr\n"); + print "\n"; + print (CONFIG "disk wd0 at wdc0 drive 0\n"); + print (CONFIG "disk wd1 at wdc0 drive 1\n"); + print "\n"; + } +} + diff --git a/contrib/configit/README b/contrib/configit/README new file mode 100644 index 000000000000..cf3481d06846 --- /dev/null +++ b/contrib/configit/README @@ -0,0 +1,32 @@ + + + +This is the README file for ConfigIt!, a kernel configuration file generator +for FreeBSD 1.1Beta and above. ConfigIt! is a menu driven program that +askes what options and devices you want in your kernel. For more information +on what the various options and devices are please see the file options.texi +in /sys/i386/doc. + +To run ConfigIt! you must have Perl 4.036 (It has not been tested with Perl 5). + +Steps needed to run ConfigIt!: +1. Make sure that you have Perl installed on your system. +2. Untar the archive in the directory where you wish to run it. +3. Run the program. +4. Copy the resulting config file to /sys/i386/conf. +5. Run config SYSTEM_NAME. +6. Change directory to /sys/compile/SYSTEM_NAME. +7. Run make depend and then make in /sys/compile/SYSTEM_NAME. + +And thats it! + +If you have any questions, suggestions or whatever you can reach me +at gclarkii@freefall.cdrom.com. Please DO NOT send questions about ConfigIt! +to the mailing lists. + +Enjoy, + +Gary Clark II +gclarkii@freefall.cdrom.com + + diff --git a/contrib/configit/TODO b/contrib/configit/TODO new file mode 100644 index 000000000000..9ab174419219 --- /dev/null +++ b/contrib/configit/TODO @@ -0,0 +1,9 @@ +TODO list for ConfigIt! +Version 0.1 BETA + +1. Make the system more robust in taking anwsers to questions. +2. Better SCSI support. +3. Make it faster. +4. Add more options that it will configure. +5. Clean up code so that columns are lined up. + diff --git a/contrib/crunch/COPYRIGHT b/contrib/crunch/COPYRIGHT new file mode 100644 index 000000000000..c7b4d2f9ae57 --- /dev/null +++ b/contrib/crunch/COPYRIGHT @@ -0,0 +1,25 @@ +/* + * Copyright (c) 1994 University of Maryland + * All Rights Reserved. + * + * 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, and that the name of U.M. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. U.M. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. + * 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. + * + * Author: James da Silva, Systems Design and Analysis Group + * Computer Science Department + * University of Maryland at College Park + */ diff --git a/contrib/crunch/Makefile b/contrib/crunch/Makefile new file mode 100644 index 000000000000..a38e0b9061df --- /dev/null +++ b/contrib/crunch/Makefile @@ -0,0 +1,4 @@ + +SUBDIR=crunchgen crunchide + +.include diff --git a/contrib/crunch/Makefile.inc b/contrib/crunch/Makefile.inc new file mode 100644 index 000000000000..da4210505219 --- /dev/null +++ b/contrib/crunch/Makefile.inc @@ -0,0 +1,2 @@ +# modify to taste +BINDIR?= /usr/bin diff --git a/contrib/crunch/README b/contrib/crunch/README new file mode 100644 index 000000000000..27c2d0298afb --- /dev/null +++ b/contrib/crunch/README @@ -0,0 +1,88 @@ + +CRUNCH 0.2 README 6/14/94 + +Crunch is available via anonymous ftp to ftp.cs.umd.edu in + pub/bsd/crunch-0.2.tar.gz + + +WHAT'S NEW IN 0.2 + +* The prototype awk script has been replaced by a more capable and + hopefully more robust C program. +* No fragile template makefiles or dependencies on the details of the + bsd build environment. +* You can build crunched binaries even with no sources on-line, you + just need the .o files. Crunchgen still will try to figure out as + much as possible on its own, but you can override its guessing by + specifying the list of .o files explicitly. +* Crunch itself has been bmake'd and some man pages written, so it + should be ready to install. + + +INTRODUCTION + +Crunch is a little package that helps create "crunched" binaries for use +on boot, install, and fixit floppies. A crunched binary in this case is +one where many programs have been linked together into one a.out file. +The different programs are run depending on the value of argv[0], so +hard links to the crunched binary suffice to simulate a perfectly normal +system. + +As an example, I have created an 980K crunched "fixit" binary containing +the following programs in their entirety: + + cat chmod cp date dd df echo ed expr hostname kill ln ls mkdir + mt mv pwd rcp rm rmdir sh sleep stty sync test [ badsect chown + clri disklabel dump rdump dmesg fdisk fsck halt ifconfig init + mknod mount newfs ping reboot restore rrestore swapon umount + ftp rsh sed telnet rlogin vi cpio gzip gunzip gzcat + +Note carefully: vi, cpio, gzip, ed, sed, dump/restore, some networking +utilities, and the disk management utilities, all in a binary small +enough to fit on a 1.2 MB root filesystem floppy (albeit with the kernel +on its own boot floppy). A more reasonable subset can be made to fit +easily with a kernel for a decent one-disk fixit filesystem. + +The linking together of different programs by hand is an old +space-saving technique. Crunch automates the process by building the +necessary stub files and makefile for you (via the crunchgen program), +and by doctoring the symbol tables of the component .o files to allow +them to link without "symbol multiply defined" conflicts (via the +crunchide program). + + +BUILDING CRUNCH + +Just type make, then make install. + +Crunch was written and tested under NetBSD/i386, but should work under +other PC BSD systems that use GNU ld. + +The crunchgen(1) and crunchide(1) man pages have more details on using +crunch, and the examples subdirectory contains some working .conf files +and a sample Makefile. + +CREDITS + +Thanks to the NetBSD team for a consistently high quality effort in +bringing together a solid, state of the art development environment. + +Thanks to the FreeBSD guys; Rod Grimes, Nate Williams and Jordan +Hubbard; and to Bruce Evans, for immediate and detailed feedback on +crunch 0.1, and for pressing me to make the prototype more useable. + +Crunch was written for the Maruti Hard Real-Time Operating System +project at the University of Maryland, to help make for better install +and recovery procedures for our NetBSD-based development environment. It +is copyright (c) 1994 by the University of Maryland under a UCB-style +freely- redistributable notice. See the file COPYRIGHT for details. + +Please let me know of any problems or of enhancements you make to this +package. I'm particularly interested in the details of what you found +was good to put on your fixit or install disks. Thanks! + +Share and Enjoy, +Jaime +............................................................................ +: Stand on my shoulders, : jds@cs.umd.edu : James da Silva +: not on my toes. : uunet!mimsy!jds : http://www.cs.umd.edu/users/jds diff --git a/contrib/crunch/crunchgen/Makefile b/contrib/crunch/crunchgen/Makefile new file mode 100644 index 000000000000..71acb214dca0 --- /dev/null +++ b/contrib/crunch/crunchgen/Makefile @@ -0,0 +1,9 @@ + +PROG=crunchgen +SRCS=crunchgen.c crunched_skel.c +CFLAGS+=-g -Wall + +crunched_skel.c: crunched_main.c + ${.CURDIR}/mkskel.sh ${.CURDIR}/crunched_main.c >crunched_skel.c + +.include diff --git a/contrib/crunch/crunchgen/crunched_main.c b/contrib/crunch/crunchgen/crunched_main.c new file mode 100644 index 000000000000..a07317aa5a6b --- /dev/null +++ b/contrib/crunch/crunchgen/crunched_main.c @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1994 University of Maryland + * All Rights Reserved. + * + * 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, and that the name of U.M. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. U.M. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. + * 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. + * + * Author: James da Silva, Systems Design and Analysis Group + * Computer Science Department + * University of Maryland at College Park + */ +/* + * crunched_main.c - main program for crunched binaries, it branches to a + * particular subprogram based on the value of argv[0]. Also included + * is a little program invoked when the crunched binary is called via + * its EXECNAME. This one prints out the list of compiled-in binaries, + * or calls one of them based on argv[1]. This allows the testing of + * the crunched binary without creating all the links. + */ +#include +#include + +struct stub { + char *name; + int (*f)(); +}; + +extern struct stub entry_points[]; + +int main(int argc, char **argv) +{ + char *slash, *basename; + struct stub *ep; + + if(argv[0] == NULL || *argv[0] == '\0') + crunched_usage(); + + slash = strrchr(argv[0], '/'); + basename = slash? slash+1 : argv[0]; + + for(ep=entry_points; ep->name != NULL; ep++) + if(!strcmp(basename, ep->name)) break; + + if(ep->name) + return ep->f(argc, argv); + else { + fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, basename); + crunched_usage(); + } +} + + +int crunched_main(int argc, char **argv) +{ + struct stub *ep; + int columns, len; + + if(argc <= 1) + crunched_usage(); + + return main(--argc, ++argv); +} + + +int crunched_usage() +{ + int columns, len; + struct stub *ep; + + fprintf(stderr, "Usage: %s ..., where is one of:\n", + EXECNAME); + columns = 0; + for(ep=entry_points; ep->name != NULL; ep++) { + len = strlen(ep->name) + 1; + if(columns+len < 80) + columns += len; + else { + fprintf(stderr, "\n"); + columns = len; + } + fprintf(stderr, " %s", ep->name); + } + fprintf(stderr, "\n"); + exit(1); +} + +/* end of crunched_main.c */ + diff --git a/contrib/crunch/crunchgen/crunchgen.1 b/contrib/crunch/crunchgen/crunchgen.1 new file mode 100644 index 000000000000..8c97d66cf1de --- /dev/null +++ b/contrib/crunch/crunchgen/crunchgen.1 @@ -0,0 +1,266 @@ +.\" +.\" Copyright (c) 1994 University of Maryland +.\" All Rights Reserved. +.\" +.\" 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, and that the name of U.M. not be used in advertising or +.\" publicity pertaining to distribution of the software without specific, +.\" written prior permission. U.M. makes no representations about the +.\" suitability of this software for any purpose. It is provided "as is" +.\" without express or implied warranty. +.\" +.\" U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. +.\" 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. +.\" +.\" Author: James da Silva, Systems Design and Analysis Group +.\" Computer Science Department +.\" University of Maryland at College Park +.\" +.Dd June 14, 1994 +.Dt CRUNCHGEN 1 +.Os BSD 4 +.Sh NAME +.Nm \&crunchgen +.Nd generates build environment for a crunched binary +.Sh SYNOPSIS +.Nm \&crunchgen +.Op Fl fq +.Op Fl m Ar makefile-name +.Op Fl c Ar c-file-name +.Op Fl e Ar exec-file-name +.Op Ar conf-file +.Sh DESCRIPTION + +A crunched binary is a program made up of many other programs linked +together into a single executable. The crunched binary main() +function determines which component program to run by the contents of +argv[0]. The main reason to crunch programs together is for fitting +as many programs as possible onto an installation or system recovery +floppy. + +.Pp +.Nm Crunchgen +reads in the specifications in +.Ar conf-file +for a crunched binary, and generates a Makefile and accompanying +top-level C source file that when built create the crunched executable +file from the component programs. For each component program, +.Nm crunchgen +can optionally attempt to determine the object (.o) files that make up +the program from its source directory Makefile. This information is +cached between runs. +.Nm Crunchgen +uses the companion program +.Nm crunchide +to eliminate link-time conflicts between the component programs by +hiding all unnecessary symbols. + +.Pp +After +.Nm crunchgen +is run, the crunched binary can be built by running ``make -f +.mk''. The component programs' object files must already +be built. A ``objs'' target, included in the output makefile, will +run make in each component program's source dir to build the object +files for the user. This is not done automatically since in release +engineering circumstances it is generally not desireable to be +modifying objects in other directories. + +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl c Ar c-file-name +Set output C file name to +.Ar c-file-name . +The default name is ``.c''. +.It Fl e Ar exec-file-name +Set crunched binary executable file name to +.Ar exec-file-name . +The default name is ``''. +.It Fl f +Flush cache. Forces the recalculation of cached parameters. +.It Fl m Ar makefile-name +Set output Makefile name to +.Ar makefile-name . +The default name is ``.mk''. +.It Fl q +Quiet operation. Status messages are suppressed. +.El +.Sh CRUNCHGEN CONFIGURATION FILE COMMANDS + +.Nm Crunchgen +reads specifications from the +.Ar conf-file +that describe the components of the crunched binary. In its simplest +use, the component program names are merely listed along with the +top-level source directories in which their sources can be found. +.Nm Crunchgen +then calculates (via the source makefiles) and caches the +list of object files and their locations. For more specialized +situations, the user can specify by hand all the parameters that +.Nm crunchgen +needs. +.Pp +The +.Ar conf-file +commands are as follows: +.Bl -tag -width indent +.It Nm srcdirs Ar dirname ... +A list of source trees in which the source directories of the +component programs can be found. These dirs are searched using the +BSD ``//'' convention. Multiple +.Nm srcdirs +lines can be specified. The directories are searched in the order +they are given. +.It Nm progs Ar progname ... +A list of programs that make up the crunched binary. Multiple +.Nm progs +lines can be specified. +.It Nm libs Ar libspec ... +A list of library specifications to be included in the crunched binary link. +Multiple +.Nm libs +lines can be specified. +.It Nm ln Ar progname linkname +Causes the crunched binary to invoke +.Ar progname +whenever +.Ar linkname +appears in argv[0]. This allows programs that change their behavior when +run under different names to operate correctly. +.El + +To handle specialized situations, such as when the source is not +available or not built via a conventional Makefile, the following +.Nm special +commands can be used to set +.Nm crunchgen +parameters for a component program. +.Bl -tag -width indent +.It Nm special Ar progname Nm srcdir Ar pathname +Set the source directory for +.Ar progname . +This is normally calculated by searching the specified +.Nm srcdirs +for a directory named +.Ar progname . +.It Nm special Ar progname Nm objdir Ar pathname +Set the obj directory for +.Ar progname . +This is normally calculated by looking for a directory named +.Dq Pa obj +under the +.Ar srcdir , +and if that is not found, the +.Ar srcdir +itself becomes the +.Ar objdir . +.It Nm special Ar progname Nm objs Ar object-file-name ... +Set the list of object files for program +.Ar progname . +This is normally calculated by constructing a temporary makefile that includes +.Dq Nm srcdir / Pa Makefile +and outputs the value of $(OBJS). +.It Nm special Ar progname Nm objpaths Ar full-pathname-to-object-file ... +Sets the pathnames of the object files for program +.Ar progname . +This is normally calculated by prepending the +.Nm objdir +pathname to each file in the +.Nm objs +list. +.El + +.Pp +Only the +.Nm objpaths +parameter is actually needed by +.Nm crunchgen , +but it is calculated from +.Nm objdir +and +.Nm objs , +which are in turn calculated from +.Nm srcdir , +so is sometimes convenient to specify the earlier parameters and let +.Nm crunchgen +calculate forward from there if it can. + +.Pp +The makefile produced by +.Nm crunchgen +contains an optional +.Ar objs +target that will build the object files for each component program by +running make inside that program's source directory. For this to work the +.Nm srcdir +and +.Nm objs +parameters must also be valid. If they are not valid for a particular program, that +program is skipped in the +.Ar objs +target. +.Sh EXAMPLE +Here is an example +.Nm crunchgen +input conf file, named +.Dq Pa kcopy.conf : +.Pp +.nf + srcdirs /usr/src/bin /usr/src/sbin + + progs test cp echo sh fsck halt init mount umount myinstall + ln test [ # test can be invoked via [ + ln sh -sh # init invokes the shell with "-sh" in argv[0] + + special myprog objpaths /homes/leroy/src/myinstall.o # no sources + + libs -lutil -lcrypt +.fi +.Pp +This conf file specifies a small crunched binary consisting of some +basic system utilities plus a homegrown install program ``myinstall'', +for which no source directory is specified, but its object file is +specified directly with the +.Nm special +line. +.Pp +The crunched binary ``kcopy'' can be built as follows: +.Pp +.nf + % crunchgen -m Makefile kcopy.conf # gen Makefile and kcopy.c + % make objs # build the component progams' .o files + % make # build the crunched binary kcopy + % kcopy sh # test that this invokes a sh shell + $ # it works! +.fi +.Pp +At this point the binary ``kcopy'' can be copied onto an install floppy +and hard-linked to the names of the component programs. +.Sh SEE ALSO +.Xr crunchide 1 +.Sh CAVEATS +While +.Nm crunch +takes care to eliminate link conflicts between the component programs +of a crunched binary, conflicts are still possible between the +libraries that are linked in. Some shuffling in the order of +libraries may be required, and in some rare cases two libraries may +have an unresolveable conflict and thus cannot be crunched together. +.Pp +Some versions of the BSD build environment do not by default build the +intermediate object file for single-source file programs. The ``make +objs'' target must then be used to get those object files built, or +some other arrangements made. +.Sh AUTHOR +.Nm Crunch +was written by James da Silva . +.sp 0 +Copyright (c) 1994 University of Maryland. All Rights Reserved. diff --git a/contrib/crunch/crunchgen/crunchgen.c b/contrib/crunch/crunchgen/crunchgen.c new file mode 100644 index 000000000000..6e9af1880dd9 --- /dev/null +++ b/contrib/crunch/crunchgen/crunchgen.c @@ -0,0 +1,856 @@ +/* + * Copyright (c) 1994 University of Maryland + * All Rights Reserved. + * + * 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, and that the name of U.M. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. U.M. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. + * 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. + * + * Author: James da Silva, Systems Design and Analysis Group + * Computer Science Department + * University of Maryland at College Park + */ +/* + * ======================================================================== + * crunchgen.c + * + * Generates a Makefile and main C file for a crunched executable, + * from specs given in a .conf file. + */ +#include +#include +#include +#include +#include + +#include +#include +#include + +#define CRUNCH_VERSION "0.2" + +#define MAXLINELEN 16384 +#define MAXFIELDS 2048 + + +/* internal representation of conf file: */ + +/* simple lists of strings suffice for most parms */ + +typedef struct strlst { + struct strlst *next; + char *str; +} strlst_t; + +/* progs have structure, each field can be set with "special" or calculated */ + +typedef struct prog { + struct prog *next; + char *name, *ident; + char *srcdir, *objdir; + strlst_t *objs, *objpaths; + strlst_t *links; + int goterror; +} prog_t; + + +/* global state */ + +strlst_t *srcdirs = NULL; +strlst_t *libs = NULL; +prog_t *progs = NULL; + +char line[MAXLINELEN]; + +char confname[MAXPATHLEN], infilename[MAXPATHLEN]; +char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; +char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; +int linenum = -1; +int goterror = 0; + +char *pname = "crunchgen"; + +int verbose, readcache; /* options */ +int reading_cache; + +/* general library routines */ + +void status(char *str); +void out_of_memory(void); +void add_string(strlst_t **listp, char *str); +int is_dir(char *pathname); +int is_nonempty_file(char *pathname); + +/* helper routines for main() */ + +void usage(void); +void parse_conf_file(void); +void gen_outputs(void); + + +int main(int argc, char **argv) +{ + char *p; + int optc; + extern int optind; + extern char *optarg; + + verbose = 1; + readcache = 1; + *outmkname = *outcfname = *execfname = '\0'; + + if(argc > 0) pname = argv[0]; + + while((optc = getopt(argc, argv, "m:c:e:fq")) != -1) { + switch(optc) { + case 'f': readcache = 0; break; + case 'q': verbose = 0; break; + + case 'm': strcpy(outmkname, optarg); break; + case 'c': strcpy(outcfname, optarg); break; + case 'e': strcpy(execfname, optarg); break; + + case '?': + default: usage(); + } + } + + argc -= optind; + argv += optind; + + if(argc != 1) usage(); + + /* + * generate filenames + */ + + strcpy(infilename, argv[0]); + + /* confname = `basename infilename .conf` */ + + if((p=strrchr(infilename, '/')) != NULL) strcpy(confname, p+1); + else strcpy(confname, infilename); + if((p=strrchr(confname, '.')) != NULL && !strcmp(p, ".conf")) *p = '\0'; + + if(!*outmkname) sprintf(outmkname, "%s.mk", confname); + if(!*outcfname) sprintf(outcfname, "%s.c", confname); + if(!*execfname) sprintf(execfname, "%s", confname); + + sprintf(cachename, "%s.cache", confname); + sprintf(tempfname, ".tmp_%sXXXXXX", confname); + if(mktemp(tempfname) == NULL) { + perror(tempfname); + exit(1); + } + + parse_conf_file(); + gen_outputs(); + + exit(goterror); +} + + +void usage(void) +{ + fprintf(stderr, + "%s [-fq] [-m ] [-c ] [-e ] \n", + pname); + exit(1); +} + + +/* + * ======================================================================== + * parse_conf_file subsystem + * + */ + +/* helper routines for parse_conf_file */ + +void parse_one_file(char *filename); +void parse_line(char *line, int *fc, char **fv, int nf); +void add_srcdirs(int argc, char **argv); +void add_progs(int argc, char **argv); +void add_link(int argc, char **argv); +void add_libs(int argc, char **argv); +void add_special(int argc, char **argv); + +prog_t *find_prog(char *str); +void add_prog(char *progname); + + +void parse_conf_file(void) +{ + if(!is_nonempty_file(infilename)) { + fprintf(stderr, "%s: fatal: input file \"%s\" not found.\n", + pname, infilename); + exit(1); + } + parse_one_file(infilename); + if(readcache && is_nonempty_file(cachename)) { + reading_cache = 1; + parse_one_file(cachename); + } +} + + +void parse_one_file(char *filename) +{ + char *fieldv[MAXFIELDS]; + int fieldc; + void (*f)(int c, char **v); + FILE *cf; + + sprintf(line, "reading %s", filename); + status(line); + strcpy(curfilename, filename); + + if((cf = fopen(curfilename, "r")) == NULL) { + perror(curfilename); + goterror = 1; + return; + } + + linenum = 0; + while(fgets(line, MAXLINELEN, cf) != NULL) { + linenum++; + parse_line(line, &fieldc, fieldv, MAXFIELDS); + if(fieldc < 1) continue; + if(!strcmp(fieldv[0], "srcdirs")) f = add_srcdirs; + else if(!strcmp(fieldv[0], "progs")) f = add_progs; + else if(!strcmp(fieldv[0], "ln")) f = add_link; + else if(!strcmp(fieldv[0], "libs")) f = add_libs; + else if(!strcmp(fieldv[0], "special")) f = add_special; + else { + fprintf(stderr, "%s:%d: skipping unknown command `%s'.\n", + curfilename, linenum, fieldv[0]); + goterror = 1; + continue; + } + if(fieldc < 2) { + fprintf(stderr, + "%s:%d: %s command needs at least 1 argument, skipping.\n", + curfilename, linenum, fieldv[0]); + goterror = 1; + continue; + } + f(fieldc, fieldv); + } + + if(ferror(cf)) { + perror(curfilename); + goterror = 1; + } + fclose(cf); +} + + +void parse_line(char *line, int *fc, char **fv, int nf) +{ + char *p; + + p = line; + *fc = 0; + while(1) { + while(isspace(*p)) p++; + if(*p == '\0' || *p == '#') break; + + if(*fc < nf) fv[(*fc)++] = p; + while(*p && !isspace(*p) && *p != '#') p++; + if(*p == '\0' || *p == '#') break; + *p++ = '\0'; + } + if(*p) *p = '\0'; /* needed for '#' case */ +} + + +void add_srcdirs(int argc, char **argv) +{ + int i; + + for(i=1;inext) + if(!strcmp(p2->name, progname)) return; + + p2 = malloc(sizeof(prog_t)); + if(p2) p2->name = strdup(progname); + if(!p2 || !p2->name) + out_of_memory(); + + p2->next = NULL; + if(p1 == NULL) progs = p2; + else p1->next = p2; + + p2->ident = p2->srcdir = p2->objdir = NULL; + p2->links = p2->objs = NULL; + p2->goterror = 0; +} + + +void add_link(int argc, char **argv) +{ + int i; + prog_t *p = find_prog(argv[1]); + + if(p == NULL) { + fprintf(stderr, + "%s:%d: no prog %s previously declared, skipping link.\n", + curfilename, linenum, argv[1]); + goterror = 1; + return; + } + for(i=2;ilinks, argv[i]); +} + + +void add_libs(int argc, char **argv) +{ + int i; + + for(i=1;iident = strdup(argv[3])) == NULL) + out_of_memory(); + } + else if(!strcmp(argv[2], "srcdir")) { + if(argc != 4) goto argcount; + if((p->srcdir = strdup(argv[3])) == NULL) + out_of_memory(); + } + else if(!strcmp(argv[2], "objdir")) { + if(argc != 4) goto argcount; + if((p->objdir = strdup(argv[3])) == NULL) + out_of_memory(); + } + else if(!strcmp(argv[2], "objs")) { + p->objs = NULL; + for(i=3;iobjs, argv[i]); + } + else if(!strcmp(argv[2], "objpaths")) { + p->objpaths = NULL; + for(i=3;iobjpaths, argv[i]); + } + else { + fprintf(stderr, "%s:%d: bad parameter name `%s', skipping line.\n", + curfilename, linenum, argv[2]); + goterror = 1; + } + return; + + + argcount: + fprintf(stderr, + "%s:%d: too %s arguments, expected \"special %s %s \".\n", + curfilename, linenum, argc < 4? "few" : "many", argv[1], argv[2]); + goterror = 1; +} + + +prog_t *find_prog(char *str) +{ + prog_t *p; + + for(p = progs; p != NULL; p = p->next) + if(!strcmp(p->name, str)) return p; + + return NULL; +} + + +/* + * ======================================================================== + * gen_outputs subsystem + * + */ + +/* helper subroutines */ + +void remove_error_progs(void); +void fillin_program(prog_t *p); +void gen_specials_cache(void); +void gen_output_makefile(void); +void gen_output_cfile(void); + +void fillin_program_objs(prog_t *p, char *path); +void top_makefile_rules(FILE *outmk); +void prog_makefile_rules(FILE *outmk, prog_t *p); +void output_strlst(FILE *outf, strlst_t *lst); +char *genident(char *str); +char *dir_search(char *progname); + + +void gen_outputs(void) +{ + prog_t *p; + + for(p = progs; p != NULL; p = p->next) + fillin_program(p); + + remove_error_progs(); + gen_specials_cache(); + gen_output_cfile(); + gen_output_makefile(); + status(""); + fprintf(stderr, + "Run \"make -f %s objs exe\" to build crunched binary.\n", + outmkname); +} + + +void fillin_program(prog_t *p) +{ + char path[MAXPATHLEN]; + char *srcparent; + strlst_t *s; + + sprintf(line, "filling in parms for %s", p->name); + status(line); + + if(!p->ident) + p->ident = genident(p->name); + if(!p->srcdir) { + srcparent = dir_search(p->name); + if(srcparent) + sprintf(path, "%s/%s", srcparent, p->name); + if(is_dir(path)) + p->srcdir = strdup(path); + } + if(!p->objdir && p->srcdir) { + sprintf(path, "%s/obj", p->srcdir); + if(is_dir(path)) + p->objdir = strdup(path); + else + p->objdir = p->srcdir; + } + + if(p->srcdir) sprintf(path, "%s/Makefile", p->srcdir); + if(!p->objs && p->srcdir && is_nonempty_file(path)) + fillin_program_objs(p, path); + + if(!p->objpaths && p->objdir && p->objs) + for(s = p->objs; s != NULL; s = s->next) { + sprintf(line, "%s/%s", p->objdir, s->str); + add_string(&p->objpaths, line); + } + + if(!p->srcdir && verbose) + fprintf(stderr, "%s: %s: warning: could not find source directory.\n", + infilename, p->name); + if(!p->objs && verbose) + fprintf(stderr, "%s: %s: warning: could not find any .o files.\n", + infilename, p->name); + + if(!p->objpaths) { + fprintf(stderr, + "%s: %s: error: no objpaths specified or calculated.\n", + infilename, p->name); + p->goterror = goterror = 1; + } +} + +void fillin_program_objs(prog_t *p, char *path) +{ + char *obj, *cp; + int rc; + FILE *f; + + /* discover the objs from the srcdir Makefile */ + + if((f = fopen(tempfname, "w")) == NULL) { + perror(tempfname); + goterror = 1; + return; + } + + fprintf(f, ".include \"%s\"\n", path); + fprintf(f, ".if defined(PROG) && !defined(OBJS)\n"); + fprintf(f, "OBJS=${PROG}.o\n"); + fprintf(f, ".endif\n"); + fprintf(f, "crunchgen_objs:\n\t@echo 'OBJS= '${OBJS}\n"); + fclose(f); + + sprintf(line, "make -f %s crunchgen_objs 2>&1", tempfname); + if((f = popen(line, "r")) == NULL) { + perror("submake pipe"); + goterror = 1; + return; + } + + while(fgets(line, MAXLINELEN, f)) { + if(strncmp(line, "OBJS= ", 6)) { + fprintf(stderr, "make error: %s", line); + goterror = 1; + continue; + } + cp = line + 6; + while(isspace(*cp)) cp++; + while(*cp) { + obj = cp; + while(*cp && !isspace(*cp)) cp++; + if(*cp) *cp++ = '\0'; + add_string(&p->objs, obj); + while(isspace(*cp)) cp++; + } + } + if((rc=pclose(f)) != 0) { + fprintf(stderr, "make error: make returned %d\n", rc); + goterror = 1; + } + unlink(tempfname); +} + +void remove_error_progs(void) +{ + prog_t *p1, *p2; + + p1 = NULL; p2 = progs; + while(p2 != NULL) { + if(!p2->goterror) + p1 = p2, p2 = p2->next; + else { + /* delete it from linked list */ + fprintf(stderr, "%s: %s: ignoring program because of errors.\n", + infilename, p2->name); + if(p1) p1->next = p2->next; + else progs = p2->next; + p2 = p2->next; + } + } +} + +void gen_specials_cache(void) +{ + FILE *cachef; + prog_t *p; + + sprintf(line, "generating %s", cachename); + status(line); + + if((cachef = fopen(cachename, "w")) == NULL) { + perror(cachename); + goterror = 1; + return; + } + + fprintf(cachef, "# %s - parm cache generated from %s by crunchgen %s\n\n", + cachename, infilename, CRUNCH_VERSION); + + for(p = progs; p != NULL; p = p->next) { + fprintf(cachef, "\n"); + if(p->srcdir) + fprintf(cachef, "special %s srcdir %s\n", p->name, p->srcdir); + if(p->objdir) + fprintf(cachef, "special %s objdir %s\n", p->name, p->objdir); + if(p->objs) { + fprintf(cachef, "special %s objs", p->name); + output_strlst(cachef, p->objs); + } + fprintf(cachef, "special %s objpaths", p->name); + output_strlst(cachef, p->objpaths); + } + fclose(cachef); +} + + +void gen_output_makefile(void) +{ + prog_t *p; + FILE *outmk; + + sprintf(line, "generating %s", outmkname); + status(line); + + if((outmk = fopen(outmkname, "w")) == NULL) { + perror(outmkname); + goterror = 1; + return; + } + + fprintf(outmk, "# %s - generated from %s by crunchgen %s\n\n", + outmkname, infilename, CRUNCH_VERSION); + + top_makefile_rules(outmk); + + for(p = progs; p != NULL; p = p->next) + prog_makefile_rules(outmk, p); + + fprintf(outmk, "\n# ========\n"); + fclose(outmk); +} + + +void gen_output_cfile(void) +{ + extern char *crunched_skel[]; + char **cp; + FILE *outcf; + prog_t *p; + strlst_t *s; + + sprintf(line, "generating %s", outcfname); + status(line); + + if((outcf = fopen(outcfname, "w")) == NULL) { + perror(outcfname); + goterror = 1; + return; + } + + fprintf(outcf, + "/* %s - generated from %s by crunchgen %s */\n", + outcfname, infilename, CRUNCH_VERSION); + + fprintf(outcf, "#define EXECNAME \"%s\"\n", execfname); + for(cp = crunched_skel; *cp != NULL; cp++) + fprintf(outcf, "%s\n", *cp); + + for(p = progs; p != NULL; p = p->next) + fprintf(outcf, "extern int _crunched_%s_stub();\n", p->ident); + + fprintf(outcf, "\nstruct stub entry_points[] = {\n"); + for(p = progs; p != NULL; p = p->next) { + fprintf(outcf, "\t{ \"%s\", _crunched_%s_stub },\n", + p->name, p->ident); + for(s = p->links; s != NULL; s = s->next) + fprintf(outcf, "\t{ \"%s\", _crunched_%s_stub },\n", + s->str, p->ident); + } + + fprintf(outcf, "\t{ EXECNAME, crunched_main },\n"); + fprintf(outcf, "\t{ NULL, NULL }\n};\n"); + fclose(outcf); +} + + +char *genident(char *str) +{ + char *n,*s,*d; + + /* + * generates a Makefile/C identifier from a program name, mapping '-' to + * '_' and ignoring all other non-identifier characters. This leads to + * programs named "foo.bar" and "foobar" to map to the same identifier. + */ + + if((n = strdup(str)) == NULL) + return NULL; + for(d = s = n; *s != '\0'; s++) { + if(*s == '-') *d++ = '_'; + else if(*s == '_' || isalnum(*s)) *d++ = *s; + } + *d = '\0'; + return n; +} + + +char *dir_search(char *progname) +{ + char path[MAXPATHLEN]; + strlst_t *dir; + + for(dir=srcdirs; dir != NULL; dir=dir->next) { + sprintf(path, "%s/%s", dir->str, progname); + if(is_dir(path)) return dir->str; + } + return NULL; +} + + +void top_makefile_rules(FILE *outmk) +{ + prog_t *p; + + fprintf(outmk, "LIBS="); + output_strlst(outmk, libs); + + fprintf(outmk, "CRUNCHED_OBJS="); + for(p = progs; p != NULL; p = p->next) + fprintf(outmk, " %s.lo", p->name); + fprintf(outmk, "\n"); + + fprintf(outmk, "SUBMAKE_TARGETS="); + for(p = progs; p != NULL; p = p->next) + fprintf(outmk, " %s_make", p->ident); + fprintf(outmk, "\n\n"); + + fprintf(outmk, "%s: %s.o $(CRUNCHED_OBJS)\n", + execfname, execfname); + fprintf(outmk, "\t$(CC) -static -o %s %s.o $(CRUNCHED_OBJS) $(LIBS)\n", + execfname, execfname); + fprintf(outmk, "\tstrip %s\n", execfname); + fprintf(outmk, "all: objs exe\nobjs: $(SUBMAKE_TARGETS)\n"); + fprintf(outmk, "exe: %s\n", execfname); + fprintf(outmk, "clean:\n\trm -f %s *.lo *.o *_stub.c\n", + execfname); +} + + +void prog_makefile_rules(FILE *outmk, prog_t *p) +{ + fprintf(outmk, "\n# -------- %s\n\n", p->name); + + if(p->srcdir && p->objs) { + fprintf(outmk, "%s_SRCDIR=%s\n", p->ident, p->srcdir); + fprintf(outmk, "%s_OBJS=", p->ident); + output_strlst(outmk, p->objs); + fprintf(outmk, "%s_make:\n", p->ident); + fprintf(outmk, "\t(cd $(%s_SRCDIR); make $(%s_OBJS))\n\n", + p->ident, p->ident); + } + else + fprintf(outmk, "%s_make:\n\t@echo \"** cannot make objs for %s\"\n\n", + p->ident, p->name); + + fprintf(outmk, "%s_OBJPATHS=", p->ident); + output_strlst(outmk, p->objpaths); + + fprintf(outmk, "%s_stub.c:\n", p->name); + fprintf(outmk, "\techo \"" + "int _crunched_%s_stub(int argc, char **argv, char **envp)" + "{return main(argc,argv,envp);}\" >%s_stub.c\n", + p->ident, p->name); + fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)\n", + p->name, p->name, p->ident); + fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)\n", + p->name, p->name, p->ident); + fprintf(outmk, "\tcrunchide -k __crunched_%s_stub %s.lo\n", + p->ident, p->name); +} + +void output_strlst(FILE *outf, strlst_t *lst) +{ + for(; lst != NULL; lst = lst->next) + fprintf(outf, " %s", lst->str); + fprintf(outf, "\n"); +} + + +/* + * ======================================================================== + * general library routines + * + */ + +void status(char *str) +{ + static int lastlen = 0; + int len, spaces; + + if(!verbose) return; + + len = strlen(str); + spaces = lastlen - len; + if(spaces < 1) spaces = 1; + + fprintf(stderr, " [%s]%*.*s\r", str, spaces, spaces, " "); + fflush(stderr); + lastlen = len; +} + + +void out_of_memory(void) +{ + fprintf(stderr, "%s: %d: out of memory, stopping.\n", infilename, linenum); + exit(1); +} + + +void add_string(strlst_t **listp, char *str) +{ + strlst_t *p1, *p2; + + /* add to end, but be smart about dups */ + + for(p1 = NULL, p2 = *listp; p2 != NULL; p1 = p2, p2 = p2->next) + if(!strcmp(p2->str, str)) return; + + p2 = malloc(sizeof(strlst_t)); + if(p2) p2->str = strdup(str); + if(!p2 || !p2->str) + out_of_memory(); + + p2->next = NULL; + if(p1 == NULL) *listp = p2; + else p1->next = p2; +} + + +int is_dir(char *pathname) +{ + struct stat buf; + + if(stat(pathname, &buf) == -1) + return 0; + return S_ISDIR(buf.st_mode); +} + +int is_nonempty_file(char *pathname) +{ + struct stat buf; + + if(stat(pathname, &buf) == -1) + return 0; + + return S_ISREG(buf.st_mode) && buf.st_size > 0; +} diff --git a/contrib/crunch/crunchgen/mkskel.sh b/contrib/crunch/crunchgen/mkskel.sh new file mode 100755 index 000000000000..fd53d78bbbac --- /dev/null +++ b/contrib/crunch/crunchgen/mkskel.sh @@ -0,0 +1,15 @@ +#! /bin/sh +# idea and sed lines taken straight from flex + +cat < diff --git a/contrib/crunch/crunchide/crunchide.1 b/contrib/crunch/crunchide/crunchide.1 new file mode 100644 index 000000000000..38a04cf6b93f --- /dev/null +++ b/contrib/crunch/crunchide/crunchide.1 @@ -0,0 +1,68 @@ +.\" +.\" Copyright (c) 1994 University of Maryland +.\" All Rights Reserved. +.\" +.\" 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, and that the name of U.M. not be used in advertising or +.\" publicity pertaining to distribution of the software without specific, +.\" written prior permission. U.M. makes no representations about the +.\" suitability of this software for any purpose. It is provided "as is" +.\" without express or implied warranty. +.\" +.\" U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. +.\" 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. +.\" +.\" Author: James da Silva, Systems Design and Analysis Group +.\" Computer Science Department +.\" University of Maryland at College Park +.\" +.Dd June 14, 1994 +.Dt CRUNCHIDE 1 +.Os BSD 4 +.Sh NAME +.Nm crunchide +.Nd hides symbol names from ld, for crunching programs together +.Sh SYNOPSIS +.Nm crunchide +.Op Fl f Ar keep-list-file +.Op Fl k Ar keep-symbol +.Op Ar object-file ... +.Sh DESCRIPTION + +.Nm Crunchide +hides the global symbols of +.Ar object-file +such that they are ignored by subsequent runs of the linker, +.Xr ld 1 . +Some symbols may be left visible via the +.Fl k Ar keep-symbol +and +.Fl f Ar keep-list-file +options. The +.Ar keep-list-file +must contain a list of symbols to keep visible, one symbol per line. +Note that the C compiler prepends an underscore in front of +symbols, so to keep the C function ``foo'' visible, the option +\&``-k _foo'' must be used. + +.Pp +.Nm Crunchide +is designed as a companion program for +.Xr crunchgen 1 , +which automates the process of creating crunched binaries from +multiple component programs. +.Sh SEE ALSO +.Xr crunchgen 1 , +.Xr ld 1 +.Sh AUTHOR +.Nm Crunch +was written by James da Silva . +.sp 0 +Copyright (c) 1994 University of Maryland. All Rights Reserved. diff --git a/contrib/crunch/crunchide/crunchide.c b/contrib/crunch/crunchide/crunchide.c new file mode 100644 index 000000000000..ae54da08cf58 --- /dev/null +++ b/contrib/crunch/crunchide/crunchide.c @@ -0,0 +1,321 @@ +/* + * Copyright (c) 1994 University of Maryland + * All Rights Reserved. + * + * 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, and that the name of U.M. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. U.M. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. + * 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. + * + * Author: James da Silva, Systems Design and Analysis Group + * Computer Science Department + * University of Maryland at College Park + */ +/* + * crunchide.c - tiptoes through an a.out symbol table, hiding all defined + * global symbols. Allows the user to supply a "keep list" of symbols + * that are not to be hidden. This program relies on the use of the + * linker's -dc flag to actually put global bss data into the file's + * bss segment (rather than leaving it as undefined "common" data). + * + * The point of all this is to allow multiple programs to be linked + * together without getting multiple-defined errors. + * + * For example, consider a program "foo.c". It can be linked with a + * small stub routine, called "foostub.c", eg: + * int foo_main(int argc, char **argv){ return main(argc, argv); } + * like so: + * cc -c foo.c foostub.c + * ld -dc -r foo.o foostub.o -o foo.combined.o + * crunchide -k _foo_main foo.combined.o + * at this point, foo.combined.o can be linked with another program + * and invoked with "foo_main(argc, argv)". foo's main() and any + * other globals are hidden and will not conflict with other symbols. + * + * TODO: + * - resolve the theoretical hanging reloc problem (see check_reloc() + * below). I have yet to see this problem actually occur in any real + * program. In what cases will gcc/gas generate code that needs a + * relative reloc from a global symbol, other than PIC? The + * solution is to not hide the symbol from the linker in this case, + * but to generate some random name for it so that it doesn't link + * with anything but holds the place for the reloc. + * - arrange that all the BSS segments start at the same address, so + * that the final crunched binary BSS size is the max of all the + * component programs' BSS sizes, rather than their sum. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char *pname = "crunchide"; + +void usage(void); + +void add_to_keep_list(char *symbol); +void add_file_to_keep_list(char *filename); + +void hide_syms(char *filename); + + +int main(argc, argv) +int argc; +char **argv; +{ + int ch; + + if(argc > 0) pname = argv[0]; + + while ((ch = getopt(argc, argv, "k:f:")) != EOF) + switch(ch) { + case 'k': + add_to_keep_list(optarg); + break; + case 'f': + add_file_to_keep_list(optarg); + break; + default: + usage(); + } + + argc -= optind; + argv += optind; + + if(argc == 0) usage(); + + while(argc) { + hide_syms(*argv); + argc--, argv++; + } + + return 0; +} + +void usage(void) +{ + fprintf(stderr, + "Usage: %s [-k ] [-f ] ...\n", + pname); + exit(1); +} + +/* ---------------------------- */ + +struct keep { + struct keep *next; + char *sym; +} *keep_list; + +void add_to_keep_list(char *symbol) +{ + struct keep *newp, *prevp, *curp; + int cmp; + + for(curp = keep_list, prevp = NULL; curp; prevp = curp, curp = curp->next) + if((cmp = strcmp(symbol, curp->sym)) <= 0) break; + + if(curp && cmp == 0) + return; /* already in table */ + + newp = (struct keep *) malloc(sizeof(struct keep)); + if(newp) newp->sym = strdup(symbol); + if(newp == NULL || newp->sym == NULL) { + fprintf(stderr, "%s: out of memory for keep list\n", pname); + exit(1); + } + + newp->next = curp; + if(prevp) prevp->next = newp; + else keep_list = newp; +} + +int in_keep_list(char *symbol) +{ + struct keep *curp; + int cmp; + + for(curp = keep_list; curp; curp = curp->next) + if((cmp = strcmp(symbol, curp->sym)) <= 0) break; + + return curp && cmp == 0; +} + +void add_file_to_keep_list(char *filename) +{ + FILE *keepf; + char symbol[1024]; + int len; + + if((keepf = fopen(filename, "r")) == NULL) { + perror(filename); + usage(); + } + + while(fgets(symbol, 1024, keepf)) { + len = strlen(symbol); + if(len && symbol[len-1] == '\n') + symbol[len-1] = '\0'; + + add_to_keep_list(symbol); + } + fclose(keepf); +} + +/* ---------------------- */ + +int nsyms, ntextrel, ndatarel; +struct exec *hdrp; +char *aoutdata, *strbase; +struct relocation_info *textrel, *datarel; +struct nlist *symbase; + + +#define SYMSTR(sp) &strbase[(sp)->n_un.n_strx] + +/* is the symbol a global symbol defined in the current file? */ +#define IS_GLOBAL_DEFINED(sp) \ + (((sp)->n_type & N_EXT) && ((sp)->n_type & N_TYPE) != N_UNDF) + +/* is the relocation entry dependent on a symbol? */ +#define IS_SYMBOL_RELOC(rp) \ + ((rp)->r_extern||(rp)->r_baserel||(rp)->r_jmptable) + +void check_reloc(char *filename, struct relocation_info *relp); + +void hide_syms(char *filename) +{ + int inf, outf, rc; + struct stat infstat; + struct relocation_info *relp; + struct nlist *symp; + + /* + * Open the file and do some error checking. + */ + + if((inf = open(filename, O_RDWR)) == -1) { + perror(filename); + return; + } + + if(fstat(inf, &infstat) == -1) { + perror(filename); + close(inf); + return; + } + + if(infstat.st_size < sizeof(struct exec)) { + fprintf(stderr, "%s: short file\n", filename); + close(inf); + return; + } + + /* + * Read the entire file into memory. XXX - Really, we only need to + * read the header and from TRELOFF to the end of the file. + */ + + if((aoutdata = (char *) malloc(infstat.st_size)) == NULL) { + fprintf(stderr, "%s: too big to read into memory\n", filename); + close(inf); + return; + } + + if((rc = read(inf, aoutdata, infstat.st_size)) < infstat.st_size) { + fprintf(stderr, "%s: read error: %s\n", filename, + rc == -1? strerror(errno) : "short read"); + close(inf); + return; + } + + /* + * Check the header and calculate offsets and sizes from it. + */ + + hdrp = (struct exec *) aoutdata; + + if(N_BADMAG(*hdrp)) { + fprintf(stderr, "%s: bad magic: not an a.out file\n", filename); + close(inf); + return; + } + +#ifdef __FreeBSD__ + textrel = (struct relocation_info *) (aoutdata + N_RELOFF(*hdrp)); + datarel = (struct relocation_info *) (aoutdata + N_RELOFF(*hdrp) + + hdrp->a_trsize); +#else + textrel = (struct relocation_info *) (aoutdata + N_TRELOFF(*hdrp)); + datarel = (struct relocation_info *) (aoutdata + N_DRELOFF(*hdrp)); +#endif + symbase = (struct nlist *) (aoutdata + N_SYMOFF(*hdrp)); + strbase = (char *) (aoutdata + N_STROFF(*hdrp)); + + ntextrel = hdrp->a_trsize / sizeof(struct relocation_info); + ndatarel = hdrp->a_drsize / sizeof(struct relocation_info); + nsyms = hdrp->a_syms / sizeof(struct nlist); + + /* + * Zap the type field of all globally-defined symbols. The linker will + * subsequently ignore these entries. Don't zap any symbols in the + * keep list. + */ + + for(symp = symbase; symp < symbase + nsyms; symp++) + if(IS_GLOBAL_DEFINED(symp) && !in_keep_list(SYMSTR(symp))) + symp->n_type = 0; + + /* + * Check whether the relocation entries reference any symbols that we + * just zapped. I don't know whether ld can handle this case, but I + * haven't encountered it yet. These checks are here so that the program + * doesn't fail silently should such symbols be encountered. + */ + + for(relp = textrel; relp < textrel + ntextrel; relp++) + check_reloc(filename, relp); + for(relp = datarel; relp < datarel + ndatarel; relp++) + check_reloc(filename, relp); + + /* + * Write the .o file back out to disk. XXX - Really, we only need to + * write the symbol table entries back out. + */ + lseek(inf, 0, SEEK_SET); + if((rc = write(inf, aoutdata, infstat.st_size)) < infstat.st_size) { + fprintf(stderr, "%s: write error: %s\n", filename, + rc == -1? strerror(errno) : "short write"); + } + + close(inf); +} + + +void check_reloc(char *filename, struct relocation_info *relp) +{ + /* bail out if we zapped a symbol that is needed */ + if(IS_SYMBOL_RELOC(relp) && symbase[relp->r_symbolnum].n_type == 0) { + fprintf(stderr, + "%s: oops, have hanging relocation for %s: bailing out!\n", + filename, SYMSTR(&symbase[relp->r_symbolnum])); + exit(1); + } +} diff --git a/contrib/crunch/examples/Makefile b/contrib/crunch/examples/Makefile new file mode 100644 index 000000000000..861e3028cb87 --- /dev/null +++ b/contrib/crunch/examples/Makefile @@ -0,0 +1,32 @@ + +CRUNCHED= fixit + +# below is boiler-plate to make $(CRUNCHED) from $(CRUNCHED).conf +# I'd use PROG instead of CRUNCHED, but the system makefiles REALLY want +# to build things in the normal way if you use PROG. + +CONF= $(CRUNCHED).conf + +OUTMK= $(CRUNCHED).mk +OUTPUTS= $(OUTMK) $(CRUNCHED).c $(CRUNCHED).cache + +NOMAN= +CLEANFILES+=$(CRUNCHED) *.o *.lo *.c *.mk *.cache +CLEANDIRFILES+=$(OUTPUTS) + +all: $(CRUNCHED) +exe: $(CRUNCHED) + +$(OUTPUTS): $(CONF) + crunchgen ${.CURDIR}/$(CONF) + +$(CRUNCHED): $(OUTPUTS) submake + +submake: + make -f $(OUTMK) +objs: + make -f $(OUTMK) objs +cleandir: + rm -f $(CLEANDIRFILES) + +.include diff --git a/contrib/crunch/examples/filesystem.conf b/contrib/crunch/examples/filesystem.conf new file mode 100644 index 000000000000..c5bcb372dc81 --- /dev/null +++ b/contrib/crunch/examples/filesystem.conf @@ -0,0 +1,26 @@ +# $Id: filesystem.conf,v 1.2 1994/06/24 16:39:29 jkh Exp $ + +srcdirs /usr/src/bin /usr/src/sbin /usr/src/gnu/usr.bin /usr/src/usr.sbin + +# /bin +progs sh expr ls mkdir rm sync test +ln test [ + +# These are needed because of UN*X's idiotic way of indicating that something +# is a login shell. +ln sh - +ln sh -sh + +# /sbin +progs disklabel fdisk halt init mount mount_pcfs newfs umount + +# /usr/bin +progs cpio gzip +ln gzip gunzip +ln gzip gzcat +ln gzip zcat + +# /usr/sbin +progs bad144 + +libs -lutil diff --git a/contrib/crunch/examples/fixit.conf b/contrib/crunch/examples/fixit.conf new file mode 100644 index 000000000000..2298d41386be --- /dev/null +++ b/contrib/crunch/examples/fixit.conf @@ -0,0 +1,41 @@ +# fixit.conf - put in anything we think we might want on a fixit floppy + +# first, we list the source dirs that our programs reside in. These are +# searched in order listed to find the dir containing each program. + +srcdirs /usr/src/bin /usr/src/sbin /usr/src/usr.bin /usr/src/usr.sbin +srcdirs /usr/src/gnu/usr.bin + +# second, we list all the programs we want to include in our crunched binary. +# The order doesn't matter. Any program that needs hard links to it gets an +# `ln' directive. + +# /bin stuff + +progs cat chmod cp date dd df echo ed expr hostname kill ln ls mkdir +progs mt mv pwd rcp rm rmdir sh sleep stty sync test + +ln test [ +ln sh -sh # init invokes the shell this way + +# /sbin stuff + +progs badsect chown clri disklabel dump dmesg fdisk fsck halt ifconfig init +progs mknod mount newfs ping reboot restore swapon umount +ln dump rdump +ln restore rrestore + +# /usr/bin stuff + +progs ftp rsh sed telnet rlogin vi + +# gnu stuff + +progs cpio gzip +ln gzip gunzip +ln gzip gzcat + +# finally, we specify the libraries to link in with our binary + +libs -lcrypt -ltelnet -lutil -ll +libs -lcurses -ltermcap diff --git a/contrib/crunch/examples/kcopy.conf b/contrib/crunch/examples/kcopy.conf new file mode 100644 index 000000000000..a50f6f28df52 --- /dev/null +++ b/contrib/crunch/examples/kcopy.conf @@ -0,0 +1,18 @@ +# $Id: kcopy.conf,v 1.3 1994/06/24 16:39:30 jkh Exp $ + +srcdirs /usr/src/bin /usr/src/sbin + +# Programs from bin/ +progs sh cp echo test +ln test [ + +# These are needed because of UN*X's idiotic way of indicating that something +# is a login shell. +ln sh - +ln sh -sh + +# +# Programs from sbin/ +progs mount mount_isofs mount_pcfs fsck halt init umount + +libs -lutil diff --git a/contrib/crunch/examples/really-big.conf b/contrib/crunch/examples/really-big.conf new file mode 100644 index 000000000000..ce5083f7051c --- /dev/null +++ b/contrib/crunch/examples/really-big.conf @@ -0,0 +1,146 @@ +# really-big.conf - just about everything, just for testing. +# This ends up having some good examples of the use of specials for +# those hard-to-reach programs. I stopped when I got tired, but we +# could probably get even more stuff (like libexec stuff) in here. +# +# This produces a 4608000 byte binary. Pretty sick and twisted, eh? + +# ========================================================================= + +srcdirs /usr/src/bin + +progs cat chmod cp csh date dd df domainname echo ed expr hostname kill +progs ln ls mkdir mt mv ps pwd rcp rm rmail rmdir sh sleep stty sync test + +ln test [ +ln sh -sh + + +# ========================================================================= + +srcdirs /usr/src/sbin + +progs badsect bim clri disklabel dmesg dump dumpfs fdisk fsck halt +progs ifconfig init mknod modload modunload mount mount_fdesc mount_isofs +progs mount_kernfs mount_lofs mount_msdos mount_portal mount_procfs mountd +progs newfs nfsd nfsiod ping quotacheck reboot restore route routed savecore +progs shutdown slattach swapon ttyflags tunefs umount +# shell scripts: fastboot + +ln dump rdump +ln restore rrestore + + +# ========================================================================= + +srcdirs /usr/src/usr.bin + +progs apropos ar asa at basename biff cal calendar cap_mkdb checknr chpass +progs cksum cmp col colcrt colrm column comm compress crontab ctags cut +progs dirname du env error expand false file find finger fmt fold fpr from +progs fsplit fstat ftp getconf getopt gprof head hexdump id indent ipcrm +progs ipcs join kdump ktrace last lastcomm leave lex lock logger locate +progs login logname look m4 machine mail make man mesg mkfifo +progs mkstr modstat more msgs netstat newsyslog nfsstat nice nm nohup +progs pagesize passwd paste patch pr printenv printf quota ranlib +progs renice rev rlogin rpcgen rpcinfo rsh rup ruptime rusers rwall rwho +progs script sed showmount size soelim split strings strip su tail talk +progs tcopy tee telnet tftp time tip tn3270 touch tput tr true tset tsort +progs tty ul uname unexpand unifdef uniq units unvis users uudecode uuencode +progs vacation vgrind vi vis vmstat w wall wc what whatis whereis who +progs whois window write xargs xinstall xstr yacc yes ypcat ypmatch ypwhich + +# shell scripts: lorder mkdep shar which +# problems: rdist uses libcompat.a(regex.o), which conflicts with +# libedit(readline.o) over regerror(). + +# special requirements + +special locate srcdir /usr/src/usr.bin/locate/locate +special tn3270 srcdir /usr/src/usr.bin/tn3270/tn3270 + + +# ========================================================================= + +srcdirs /usr/src/usr.sbin + +progs ac accton amd arp bad144 catman chown chroot config config.new cron +progs dev_mkdb diskpart edquota flcopy gettable grfinfo hilinfo htable inetd +progs iostat iteconfig kvm_mkdb mrouted mtree named portmap pppd +progs pstat pwd_mkdb quot quotaon rarpd rbootd repquota rmt rpc.bootparamd +progs rwhod sa sliplogin slstats spray sysctl syslogd tcpdump +progs traceroute trpt trsp update vipw vnconfig ypbind yppoll ypset + +special amd srcdir /usr/src/usr.sbin/amd/amd +special amd objs vers.amd.o afs_ops.o am_ops.o clock.o util.o xutil.o efs_ops.o mapc.o info_file.o info_hes.o info_ndbm.o info_passwd.o info_nis.o info_union.o map.o srvr_afs.o srvr_nfs.o mntfs.o misc_rpc.o mount_fs.o mtab.o mtab_bsd.o nfs_ops.o nfs_prot_svc.o nfs_start.o nfs_subr.o opts.o pfs_ops.o rpc_fwd.o sched.o sfs_ops.o amq_svc.o amq_subr.o umount_fs.o host_ops.o nfsx_ops.o ufs_ops.o ifs_ops.o amd.o get_args.o restart.o wire.o + + +srcdirs /usr/src/usr.sbin/lpr # lpr subsystem +progs lpr lpc lpq lprm pac lptest +special lpr srcdir /usr/src/usr.sbin/lpr/lpr + +srcdirs /usr/src/usr.sbin/sendmail # sendmail subsystem +progs mailstats makemap praliases sendmail +special sendmail srcdir /usr/src/usr.sbin/sendmail/src +ln sendmail newaliases +ln sendmail mailq + +srcdirs /usr/src/usr.sbin/timed # timed & timedc +progs timed timedc +special timed srcdir /usr/src/usr.sbin/timed/timed + +srcdirs /usr/src/usr.sbin/yp # yp subsystem +progs ypbind ypwhich ypcat ypmatch ypset yppoll + + +# ========================================================================= + +srcdirs /usr/src/gnu/usr.bin + +progs bc cpio diff diff3 gas gawk grep gzip sdiff sort tar +# shell scripts: send-pr + +srcdirs /usr/src/gnu/usr.bin/ld # ldd and ldconfig +progs ld ldd ldconfig + +# rcs stuff loses because there are cross dependencies between librcs.a and +# the individual programs. The solution would be to specify the objpaths +# directly for each one, and include the full path to librcs.a each the +# objpaths. + +# srcdirs /usr/src/gnu/usr.bin/rcs # rcs subsystem +# progs ci co ident merge rcs rcsclean rcsdiff rcsmerge rlog +# # shell script: rcsfreeze +# special rcs srcdir /usr/src/gnu/usr.bin/rcs/rcs +# libs /usr/src/gnu/usr.bin/rcs/lib/obj/librcs.a + +# gdb loses too +# progs gdb +# special gdb srcdir /usr/src/gnu/usr.bin/gdb/gdb +# libs /usr/src/gnu/usr.bin/gdb/bfd/obj/libbfd.a +# libs /usr/src/gnu/usr.bin/gdb/readline/obj/libreadline.a +# libs /usr/src/gnu/usr.bin/gdb/libiberty/obj/libiberty.a + +# groff has the same problem as rcs +# srcdirs /usr/src/gnu/usr.bin/groff # groff subsystem +# progs groff troff tbl pic eqn grops grotty grodvi refer lookbib +# progs indxbib lkbib tfmtodit addftinfo pfbtops psbb +# shell script: nroff +# special groff srcdir /usr/src/gnu/usr.bin/groff/groff +# libs /usr/src/gnu/usr.bin/groff/libgroff/obj/libgroff.a +# libs /usr/src/gnu/usr.bin/groff/libbib/obj/libbib.a +# libs /usr/src/gnu/usr.bin/groff/libdriver/obj/libdriver.a + +srcdirs /usr/src/gnu/usr.bin/gcc2 # gcc & friends +progs cc cpp cc1 + +# cc1 has the same problem as rcs and groff, but since there's only one program +# I'll go ahead and solve it as an example. + +special cc1 objpaths /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-parse.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-lang.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-lex.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-pragma.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-decl.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-typeck.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-convert.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-aux-info.o /usr/src/gnu/usr.bin/gcc2/cc1/obj/c-iterate.o /usr/src/gnu/usr.bin/gcc2/common/obj/libcc1.a + +ln gzip gunzip +ln gzip gzcat + +libs -ledit -lgnumalloc -lc -lcrypt -ltermcap -lcurses -ltelnet -lutil -lkvm +libs -ll -ly -lm -lresolv -lrpcsvc -lcompat diff --git a/contrib/manctl/Makefile b/contrib/manctl/Makefile new file mode 100644 index 000000000000..7a2ae922f572 --- /dev/null +++ b/contrib/manctl/Makefile @@ -0,0 +1,11 @@ +# Makefile +# $Id: Makefile,v 1.4 1994/05/26 20:16:49 csgr Exp $ + +all: + @echo -n + +install: all + install -c -o ${BINOWN} -g ${BINGRP} -m 555 ${.CURDIR}/manctl.sh \ + ${DESTDIR}/usr/sbin/manctl + +.include diff --git a/contrib/manctl/manctl.sh b/contrib/manctl/manctl.sh new file mode 100644 index 000000000000..97116cfb31c4 --- /dev/null +++ b/contrib/manctl/manctl.sh @@ -0,0 +1,376 @@ +#!/bin/sh +# +# Copyright (c) 1994 Geoffrey M. Rehmet, Rhodes University +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with 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: manctl.sh,v 1.4 1994/04/18 18:46:50 csgr Exp $ +# +# manctl: +# a utility for manipulating manual pages +# functions: +# compress uncompressed man pages (elliminating .so's) +# this is now two-pass. If possible, .so's +# are replaced with hard links +# uncompress compressed man pages +# purge old formatted man pages (not implemented yet) +# Things to watch out for: +# Hard links - careful with g(un)zipping! +# .so's - throw everything through soelim before gzip! +# symlinks - ignore these - eg: expn is its own man page: +# don't want to compress this! +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin + +# +# purge cat? directories +# +do_purge() +{ + echo "purge $@" 2>&1 + echo "not implemented yet\n" 2>&1 +} + + +# +# Uncompress one page +# +uncompress_page() +{ + local pname + local fname + local sect + local ext + + # break up file name + pname=$1 + IFS='.' ; set $pname + # less than 3 fields - don't know what to do with this + if [ $# -lt 3 ] ; then + IFS=" " ; echo ignoring $pname 1>&2 ; return 0 ; + fi + # construct name and section + fname=$1 ; shift + while [ $# -gt 2 ] ; do + fname=$fname.$1 + shift + done + sect=$1 + ext=$2 + + IFS=" " + case "$ext" in + gz|Z) { + IFS=" " ; set `file $pname` + if [ $2 != "gzip" ] ; then + echo moving hard link $pname 1>&2 + mv $pname $fname.$ext # link + else + if [ $2 != "symbolic" ] ; then + echo gunzipping page $pname 1>&2 + gunzip -c $pname > /tmp/manager.$$ + chmod u+w $pname + cp /tmp/manager.$$ $pname + chmod 444 $pname + mv $pname $fname.$sect + rm /tmp/manager.$$ + else + # skip symlinks - this can be + # a program like expn, which is + # its own man page ! + echo skipping symlink $pname 1>&2 + fi + fi };; + *) { + IFS=" " + echo skipping file $pname 1>&2 + } ;; + esac + # reset IFS - this is important! + IFS=" " +} + + +# +# Uncompress manpages in paths +# +do_uncompress() +{ + local i + local dir + local workdir + + workdir=`pwd` + while [ $# != 0 ] ; do + if [ -d $1 ] ; then + dir=$1 + cd $dir + for i in * ; do + case $i in + *cat?) ;; # ignore cat directories + *) { + if [ -d $i ] ; then + do_uncompress $i + else + if [ -e $i ] ; then + uncompress_page $i + fi + fi } ;; + esac + done + cd $workdir + else + echo "directory $1 not found" 1>&2 + fi + shift + done +} + +# +# Remove .so's from one file +# +so_purge_page() +{ + local so_entries + local lines + local fname + + so_entries=`grep "^\.so" $1 | wc -l` + if [ $so_entries -eq 0 ] ; then ; return 0 ; fi + + # we have a page with a .so in it + echo $1 contains a .so entry 2>&1 + + # now check how many lines in the file + lines=`wc -l < $1` + + # if the file is only one line long, we can replace it + # with a hard link! + if [ $lines -eq 1 ] ; then + fname=$1; + echo replacing $fname with a hard link + set `cat $fname`; + rm -f $fname + ln ../$2 $fname + else + echo inlining page $fname 1>&2 + cat $fname | \ + (cd .. ; soelim ) > /tmp/manager.$$ + chmod u+w $fname + cp /tmp/manager.$$ $fname + chmod 444 $fname + fi +} + +# +# Remove .so entries from man pages +# If a page consists of just one line with a .so, +# replace it with a hard link +# +remove_so() +{ + local pname + local fname + local sect + + # break up file name + pname=$1 + IFS='.' ; set $pname + if [ $# -lt 2 ] ; then + IFS=" " ; echo ignoring $pname 1>&2 ; return 0 ; + fi + # construct name and section + fname=$1 ; shift + while [ $# -gt 1 ] ; do + fname=$fname.$1 + shift + done + sect=$1 + + IFS=" " + case "$sect" in + gz) { echo file $pname already gzipped 1>&2 ; } ;; + Z) { echo file $pname already compressed 1>&2 ; } ;; + [12345678ln]*){ + IFS=" " ; set `file $pname` + if [ $2 = "gzip" ] ; then + echo moving hard link $pname 1>&2 + mv $pname $pname.gz # link + else + if [ $2 != "symbolic" ] ; then + echo "removing .so's in page $pname" 1>&2 + so_purge_page $pname + else + # skip symlink - this can be + # a program like expn, which is + # its own man page ! + echo skipping symlink $pname 1>&2 + fi + fi };; + *) { + IFS=" " + echo skipping file $pname 1>&2 + } ;; + esac + # reset IFS - this is important! + IFS=" " +} + + +# +# compress one page +# We need to watch out for hard links here. +# +compress_page() +{ + local pname + local fname + local sect + + # break up file name + pname=$1 + IFS='.' ; set $pname + if [ $# -lt 2 ] ; then + IFS=" " ; echo ignoring $pname 1>&2 ; return 0 ; + fi + # construct name and section + fname=$1 ; shift + while [ $# -gt 1 ] ; do + fname=$fname.$1 + shift + done + sect=$1 + + IFS=" " + case "$sect" in + gz) { echo file $pname already gzipped 1>&2 ; } ;; + Z) { echo file $pname already compressed 1>&2 ; } ;; + [12345678ln]*){ + IFS=" " ; set `file $pname` + if [ $2 = "gzip" ] ; then + echo moving hard link $pname 1>&2 + mv $pname $pname.gz # link + else + if [ $2 != "symbolic" ] ; then + echo gzipping page $pname 1>&2 + cat $pname | \ + (cd .. ; soelim )| gzip -c -- > /tmp/manager.$$ + chmod u+w $pname + cp /tmp/manager.$$ $pname + chmod 444 $pname + mv $pname $pname.gz + rm /tmp/manager.$$ + else + # skip symlink - this can be + # a program like expn, which is + # its own man page ! + echo skipping symlink $pname 1>&2 + fi + fi };; + *) { + IFS=" " + echo skipping file $pname 1>&2 + } ;; + esac + # reset IFS - this is important! + IFS=" " +} + +# +# Compress man pages in paths +# +do_compress_so() +{ + local i + local dir + local workdir + local what + + what=$1 + shift + workdir=`pwd` + while [ $# != 0 ] ; do + if [ -d $1 ] ; then + dir=$1 + cd $dir + for i in * ; do + case $i in + *cat?) ;; # ignore cat directories + *) { + if [ -d $i ] ; then + do_compress_so $what $i + else + if [ -e $i ] ; then + $what $i + fi + fi } ;; + esac + done + cd $workdir + else + echo "directory $1 not found" 1>&2 + fi + shift + done +} + +# +# Display a usage message +# +ctl_usage() +{ + echo "usage : $1 -compress ... " 1>&2 + echo " $1 -uncompress ... " 1>&2 + echo " $1 -purge ... " 1>&2 + echo " $1 -purge expire ... " 1>&2 + exit 1 +} + +# +# remove .so's and do compress +# +do_compress() +{ + # First remove all so's from the pages to be compressed + do_compress_so remove_so "$@" + # now do ahead and compress the pages + do_compress_so compress_page "$@" +} + +# +# dispatch options +# +if [ $# = 0 ] ; then ; ctl_usage $0 ; fi ; + +case "$1" in + -compress) shift ; do_compress "$@" ;; + -uncompress) shift ; do_uncompress "$@" ;; + -purge) shift ; do_purge "$@" ;; + *) ctl_usage $0 ;; +esac diff --git a/contrib/tcpdump/tcpdump/tcpdump.1 b/contrib/tcpdump/tcpdump/tcpdump.1 index 61148f494014..da584b45b954 100644 --- a/contrib/tcpdump/tcpdump/tcpdump.1 +++ b/contrib/tcpdump/tcpdump/tcpdump.1 @@ -1,4 +1,4 @@ -.\" @(#) $Header: /home/cvs/386BSD/src/contrib/tcpdump/tcpdump/tcpdump.1,v 1.1.1.1.2.1 1994/05/01 16:00:56 jkh Exp $ (LBL) +.\" @(#) $Header: /home/cvs/386BSD/src/contrib/tcpdump/tcpdump/tcpdump.1,v 1.2 1994/04/24 01:19:05 jkh Exp $ (LBL) .\" .\" Copyright (c) 1988, 1989, 1990, 1991, 1992 .\" The Regents of the University of California. diff --git a/contrib/tcpdump/tcpslice/tcpslice.1 b/contrib/tcpdump/tcpslice/tcpslice.1 index 92af935f2897..1e0f7dca8b19 100644 --- a/contrib/tcpdump/tcpslice/tcpslice.1 +++ b/contrib/tcpdump/tcpslice/tcpslice.1 @@ -1,4 +1,4 @@ -.\" @(#) $Header: /home/cvs/386BSD/src/contrib/tcpdump/tcpslice/tcpslice.1,v 1.1.1.1.2.1 1994/05/01 16:01:05 jkh Exp $ (LBL) +.\" @(#) $Header: /home/cvs/386BSD/src/contrib/tcpdump/tcpslice/tcpslice.1,v 1.1.1.1 1993/06/12 14:42:16 rgrimes Exp $ (LBL) .\" .\" Copyright (c) 1988-1990 The Regents of the University of California. .\" All rights reserved. diff --git a/contrib/xntpd/COPYRIGHT b/contrib/xntpd/COPYRIGHT index 711a8f1efcb4..b9ce773f163a 100644 --- a/contrib/xntpd/COPYRIGHT +++ b/contrib/xntpd/COPYRIGHT @@ -1,6 +1,6 @@ /****************************************************************************** * * - * Copyright (c) David L. Mills 1992, 1993, 1994 * + * Copyright (c) David L. Mills 1992, 1993, 1994 * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * @@ -55,4 +55,6 @@ * Torsten Duwe (Linux Port) * Paul A Vixie (TrueTime GPS driver) * Jim Jagielski (A/UX port) -*/ + * Ray Schnitzler (First pass at a Unixware1 port.) + * Ajit Thyagarajan (IP multicast support) + */ diff --git a/contrib/xntpd/Makefile.inc b/contrib/xntpd/Makefile.inc index 0983df967f72..f38f0a91a3dc 100644 --- a/contrib/xntpd/Makefile.inc +++ b/contrib/xntpd/Makefile.inc @@ -1,7 +1,7 @@ DEFS_LOCAL=-DREFCLOCK -DPARSE -NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD -DHAVE_TERMIOS +NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD AUTHDEFS= -DMD5 CLOCKDEFS= -DLOCAL_CLOCK -DPST -DWWVB -DAS2201 -DGOES -DGPSTM -DOMEGA \ - -DLEITCH + -DLEITCH -DTRAK CFLAGS+= ${NTPDEFS} ${DEFS_LOCAL} ${AUTHDEFS} ${CLOCKDEFS} ${COPTS} BINDIR?= /usr/sbin diff --git a/contrib/xntpd/README.FreeBSD b/contrib/xntpd/README.FreeBSD index 437d4783d1ed..8fd237e1640c 100644 --- a/contrib/xntpd/README.FreeBSD +++ b/contrib/xntpd/README.FreeBSD @@ -1,6 +1,8 @@ + $Id: README.FreeBSD,v 1.7 1994/04/21 21:10:20 wollman Exp $ + This version of NTP was converted to the BSD-style Makefile system by Garrett Wollman (wollman@freefall.cdrom.com); it is based on version -3.3z (late beta) from the University of Delaware. +3.3s (late beta) from the University of Delaware. Besides the Makefile changes, the DES code has been completely removed in order to make this code exportable. If you have a legal copy of @@ -8,3 +10,75 @@ in order to make this code exportable. If you have a legal copy of to the AUTHDEFS in Makefile.inc. You can change CLOCKDEFS in the same file to add other reference clocks. + +This version of xntpd knows how to talk to the kernelized NTP PLL which is +present in versions of FreeBSD-current after 21 April 1994. When this code +is more widely released, I'll provide the patches to Mills. + +---------------------------------------------------- +Support for Conrad electronic's "DCF-77 Uhr, Mobil". +---------------------------------------------------- +Conrad electronic in Germany,, Phone (+49) 962230111 (?), sells a gadget +called "DCF77 Uhr, mobil", which is a DCF77 timecode receiver with a +rs-232 interface. The price is around DM130. + 9-pin interface is Order# 97 94 57 66 + 25-pin interface is Order# 97 94 81 66 + +You must define + -DDCF77 -DPPS -DFREEBSD_CONRAD -DDEBUG +when you compile xntpd. You can later remove -DDEBUG, if you feel like it. + +You must also have + options COM_BIDIR +defined in your kernel, and finally the ttyport you intend to use must +have special interrupt vector: + device sio1 at isa? port "IO_COM2" tty irq 3 vector siointrts + ^^^^^^^^^^^^ +connect the radio-clock to the tty port and link it to /dev/refclock-0: + + cd /dev + sh MAKEDEV cua1 + ln -s /dev/cua01 /dev/refclock-0 + +make a directory to gather statistics in: + mkdir /var/tmp/ntp + +Create a /etc/ntp.conf along these lines: + + # DCF77 without PPS + server 127.127.8.20 + # DCF77 with PPS + #server 127.127.8.148 prefer + + driftfile /var/tmp/ntp/ntp.drift + statsdir /var/tmp/ntp + statistics loopstats + statistics peerstats + statistics clockstats + filegen peerstats file peerstats type day enable + filegen loopstats file loopstats type day enable + filegen clockstats file clockstats type day enable + +Try to start it: + comcontrol ttyd1 bidir + tickadj -A + xntpd -d -d -d + +You should see the red LED flash on the receiver every second now. You +may have to experiment a bit with the location, and possibly adjust the +minute variable resistor inside to get a good signal. Be aware, that just +because you see the light flash, is not the same as the signal being +received by the computer. The chip doing the work in the reciver uses +less than 1 micro-ampere, so even if RTS isn't pulled low, it will happily +receive, but be unable to buffer the signal to the rs-232 levels needed. + +You can see what's going on in /var/log/messages, and query the +daemon using xntpdc and ntpq, in particular the "clockvar" command +of ntpq will tell about the clocks healt. + +I live in Slagelse, Denmark, which is ~1000 Km from Mainflingen, yet +I have +/- 2 ms precision from this cheap gadget. If you have a very +stable signal, you can use the 'pps' address instead to improve your +timing. + +Have fun... Poul-Henning Kamp diff --git a/contrib/xntpd/RELNOTES b/contrib/xntpd/RELNOTES index 1b9d9c02c3b3..411ef452195b 100644 --- a/contrib/xntpd/RELNOTES +++ b/contrib/xntpd/RELNOTES @@ -31,6 +31,10 @@ this distribution. To make these programs: For custom tailored configuration copying Config.local.dist to Config.local and editing Config.local to suit the local needs is neccessary (at most 3 lines to change), or use one of the make's above and then tweak it. + Config.local can also be used to override common settings from the + machines/* files like the AUTHDEFS= to select very specific configurations. + Please use this feature with care and don't be disappointed if it doesn't + work the way you expect. (2) Type "make" to compile everything of general interest. Expect few or no warnings using cc and a moderate level of warnings using gcc. @@ -140,6 +144,7 @@ the meal. The converse is not always true. PC BSD/386 1.0 gcc LOCAL_CLOCK possibly see "build problems" PC Linux (pl14) gcc LOCAL_CLOCK (dw 93/10/30) PC Dell SVR4 v2.2 gcc ? (tl 93/12/30) + PC Unixware1/SVR4 cc no tickadj, ? (ras 93/04/11) NCR3445 NCR SVR4 cc LOCAL_CLOCK (tm 93/11/29) pb: Piete Brooks @@ -149,6 +154,7 @@ the meal. The converse is not always true. tl: Tony Lill tm: Tom Moore jmj: Jim Jagielski + ras: Ray Schnitzler Build Problems (and workaround): diff --git a/contrib/xntpd/VERSION b/contrib/xntpd/VERSION index 85051bd4db45..c145b870451f 100644 --- a/contrib/xntpd/VERSION +++ b/contrib/xntpd/VERSION @@ -1 +1 @@ -version=3.3c (beta) +version=3.3s (beta multicast) diff --git a/contrib/xntpd/authstuff/authspeed.c b/contrib/xntpd/authstuff/authspeed.c index c83d5b24497e..ecddbcd96ba1 100644 --- a/contrib/xntpd/authstuff/authspeed.c +++ b/contrib/xntpd/authstuff/authspeed.c @@ -2,7 +2,7 @@ * authspeed - figure out how LONG it takes to do an NTP encryption */ -#if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) +#if defined(SYS_HPUX) || defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SOLARIS) || defined(SYS_SVR4) || defined(SYS_PTX) || defined(SYS_UNIXWARE1) #define FAKE_RUSAGE #endif diff --git a/contrib/xntpd/conf/Config.local b/contrib/xntpd/conf/Config.local index 12a6dfece755..22c12a36e90a 100644 --- a/contrib/xntpd/conf/Config.local +++ b/contrib/xntpd/conf/Config.local @@ -78,7 +78,7 @@ DEFS_OPT=-DDEBUG # special distribution. # # Note: following line must always start with DEFS_LOCAL= $(DEFS_OPT) -DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DPPSPPS -DKERNEL_PLL +DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DKERNEL_PLL -DMCAST # # Radio clock support definitions (these only make sense if -DREFCLOCK @@ -182,7 +182,7 @@ DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DPPSPPS -DKERNEL_PLL # under Ultrix 4.2a/3. If the MX4200 is removed, all the rest compile on a DEC # OSF/1 Alpha. # -CLOCKDEFS= -DLOCAL_CLOCK -DAS2201PPS -DCHUPPS -DGOES -DIRIG -DMX4200PPS -DOMEGA -DPSTCLK -DTPRO -DWWVBCLK -DMSFEESPPS -DLEITCH +CLOCKDEFS= -DLOCAL_CLOCK -DAS2201PPS -DCHUPPS -DGOES -DIRIG -DMX4200PPS -DOMEGA -DPSTCLK -DTPRO -DWWVBCLK -DLEITCH # # Directory into which binaries should be installed (default /usr/local) diff --git a/contrib/xntpd/conf/Config.plain b/contrib/xntpd/conf/Config.plain new file mode 100644 index 000000000000..67dd70ad50e6 --- /dev/null +++ b/contrib/xntpd/conf/Config.plain @@ -0,0 +1,190 @@ +# This is the local configure file (distribution version). +# You must modify it to fit your particular configuration +# and name it Config.local +# The following configuratiions can be auto-generated: +# +# make Config.local.green +# make a Config.local that supports a local clock +# (i.e. allow fallback to use of the CPU's own clock) +# make Config.local.NO.clock +# make a Config.local that supports no clocks +# +# +# NOTE TO GREENHORNS +# +# For plug-'n-play and no radios or other complicated gadgetry, +# use "make Config.local.green" as above. +# +# Following defines can be set in the DEFS_OPT= define: +# +# The flag -DDEBUG includes some debugging code. To use this, include +# the define and start the daemon with one or more -d flags, depending +# on your calibration of pearannoya. The daemon will not detach your +# terminal in this case. Judicious use of grep will reduce the speaker +# volume to bearable levels. +# +# To change the location of the configuration file, use a +# -DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar. +# +# The -DSYSLOG_FILE defines allows logging messages that are normally +# reported via syslof() in a file. The file name can be configured using +# the configuration line "logfile " in CONFIG_FILE. +# +# There are three serial port system software interfaces, each of +# which is peculiar to one or more Unix versions. Define +# -DHAVE_SYSV_TTYS for basic System V compatibility; define -DSTREAM +# for POSIX compatibility including System V Streams, and +# HAVE_BSD_TTYS for 4.3bsd compatibility. Only one of these three +# should be defined. If none are defined, HAVE_BSD_TTYS is assumed. +# Usually these defines are already set correctly. +# +DEFS_OPT=-DDEBUG + +# +# The DEFS_LOCAL define picks up all flags from DEFS_OPT (do not delete that) +# and one of the following: +# +# The flag -DREFCLOCK causes the basic reference clock support to be +# compiled into the daemon. If you set this you may also want to +# configure the particular clock drivers you want in the CLOCKDEFS= line +# below. This flag affects xntpd only. This define is included by +# default when using the "make makeconfig" script. +# +# The next two sets of defines are meaningful only when radio clock +# drivers or special 1-pps signals are to be used. For systems without +# these features, these delicious complexities can be avoided. Ordinarily, +# the "make makeconfig" script figures out which ones to use, but your +# mileage may vary. +# +# There are three ways to utilize external 1-pps signals. Define +# -DPPS to include just the pps routine, such as used by the DCF77(PARSE) +# clock driver. Define -DPPSCLK to include a serial device driver +# which avoids much of the jitter due to upper level port +# processing. This requires a dedicated serial port and either the +# tty_clock line discipline or tty_clk_streams module, both of +# which are in the ./kernel directory. Define -DPPSCD to include a +# special driver which intercepts carrier-detect transitions +# generated by the pps signal. This requires a nondedicated serial +# port and the ppsclock streams module in the ./kernel directory. +# Only one of these three flags should be defined. +# +# The flag KERNEL_PLL causes code to be compiled for a special feature of +# the kernel that (a) implements the phase-lock loop and (b) provides +# a user interface to learn time, maximum error and estimated error. +# See the file README.kern in the doc directory for further info. +# This code is activated only if the relevant kernel features have +# been configured; it does not affect operation of unmodified kernels. +# To compile it, however, requires a few header files from the +# special distribution. +# +# Note: following line must always start with DEFS_LOCAL= $(DEFS_OPT) +DEFS_LOCAL= $(DEFS_OPT) -DREFCLOCK -DKERNEL_PLL -DMCAST + +# +# Radio clock support definitions (these only make sense if -DREFCLOCK +# used), which is normally the case. Note that a configuration can include +# no clocks, more than one type of clock and even multiple clocks of the +# same type. +# +# For most radio clocks operating with serial ports, accuracy can +# be considerably improved through use of the tty_clk line +# discipline or tty_clk_STREAMS streams module found in the +# ./kernel directory. These gizmos capture a timestamp upon +# occurrence of an intercept character and stuff it in the data +# stream for the clock driver to munch. To select this mode, +# postfix the driver name with the string CLK; that is, WWVB +# becomes WWVBCLK. If more than one clock is in use, the CLK +# postfix can be used with any or all of them. +# +# Alternatively, for the best accuracy, use the ppsclock streams +# module in the ./ppsclock directory to steal the carrier-detect +# transition and capture a precision timestamp. At present this +# works only with SunOS 4.1.1 or later. To select this mode, +# postfix the driver name with the string PPS; that is, AS2201 +# becomes AS2201PPS. If more than one clock is in use, the PPS +# postfix should be used with only one of them. If any PPS +# postfix is defined, the -DPPSPPS define should be used on the +# DEFS above. +# +# Define -DLOCAL_CLOCK for a local pseudo-clock to masquerade as a +# reference clock for those subnets without access to the real thing. +# Works in all systems and requires no hardware support. This is defined +# by default when using the "make makeconfig" script and greenhorn +# configuraiton. +# +# Define -DPST for a PST/Traconex 1020 WWV/H receiver. The driver +# supports both the CLK and PPS modes. It should work in all systems +# with a serial port. +# +# Define -DWWVB for a Spectracom 8170 or Netclock/2 WWVB receiver. It +# should work in all systems with a serial port. The driver supports +# both the CLK and PPS modes if the requisite kernel support is installed. +# +# Define -DCHU for a special CHU receiver using an ordinary shortwave +# radio. This requires the chu_clk line discipline or chu_clk_STREAMS +# module in the ./kernel directory. At present, this driver works only +# on SunOS4.1.x; operation in other systems has not been confirmed. +# Construction details for a suitable modem can be found in the ./gadget +# directory. The driver supports # neither the CLK nor PPS modes. +# +# Define -DPARSE for a DCF77/GPS(GENERIC) receiver. For best performance +# this requires a special parsestreams STREAMS (SunOS 4.x) module in the +# ./parse directory. Define -DPARSEPPS for PPS support via the +# DCF77/GPS (GENERIC) receiver; also, define -DPPS in the DEFS above. +# Define: -DCLOCK_MEINBERG for Meinberg clocks +# -DCLOCK_SCHMID for Schmid receivers +# -DCLOCK_DCF7000 for ELV DCF7000 +# -DCLOCK_RAWDCF for simple receivers (100/200ms pulses on Rx) +# -DCLOCK_TRIMSV6 for Trimble SV6 GPS receiver +# +# Define -DMX4200PPS for a Magnavox 4200 GPS receiver. At present, this +# driver works only on SunOS4.1.x with CPU serial ports only. The PPS +# mode is required. +# +# Define -DAS2201 for an Austron 2200A or 2201A GPS receiver. It should +# work in all systems with a serial port. The driver does not support the +# CLK mode, but does support the PPS mode. If the radio is connected to +# more than one machine, the PPS mode is required. +# +# Define -DGOES for a Kinemetrics/TrueTime 468-DC GOES receiver. This +# driver is known to work with some other TrueTime products as well, +# including the GPS-DC GPS receiver. It should work in all systems with +# a serial port. The driver does not support the CLK mode, but does +# support the PPS mode. +# +# Define -DOMEGA for a Kinemetrics/TrueTime OM-DC OMEGA receiver. It +# should work in all systems with a serial port. The driver does not +# support the CLK mode, but does support the PPS mode. +# +# Define -DTPRO for a KSI/Odetics TPRO-S IRIG-B timecode reader. This +# requires the SunOS interface driver available from KSI. The driver +# supports neither the CLK nor PPS modes. +# +# Define -DLEITCH for a Leitch CSD 5300 Master Clock System Driver for +# the HP 5061B Cesium Clock. It should work in all systems with a serial +# port. The driver does not support the CLK mode, but does support the +# PPS mode. +# +# Define -DMSFEESPPS for an EES M201 MSF receiver. It currently only works +# under SunOS 4.x with the PPSCD (ppsclock) STREAMS module, but the RCS +# files on cl.cam.ac.uk still has support for CLK and CBREAK modes. +# +# Define -DIRIG for a IRIG-B timecode timecode using the audio codec of +# the Sun SPARCstations. This requires a modified BSD audio driver and +# exclusive access to the audio port. A memo describing how it works and +# how to install the driver is in the README.irig file in the ./doc +# directory. +# +# Note: The following defines result in compilation of all the above radio +# clocks. This works on a Sun 4.1.x system which has tty_clk, chu_clk and +# ppsclock STREAMS modules installed. If the trailing CLK and PPS suffixes +# are removed and the IRIG, PARSE* and CLOCK* deleted, all of the rest compile +# under Ultrix 4.2a/3. If the MX4200 is removed, all the rest compile on a DEC +# OSF/1 Alpha. +# +CLOCKDEFS= -DLOCAL_CLOCK -DCHU -DGOES -DOMEGA -DPST -DWWVB -DLEITCH + +# +# Directory into which binaries should be installed (default /usr/local) +# +BINDIR= /usr/local/bin diff --git a/contrib/xntpd/doc/README.kern b/contrib/xntpd/doc/README.kern index 1b791c325ccf..aac26fa2e62b 100644 --- a/contrib/xntpd/doc/README.kern +++ b/contrib/xntpd/doc/README.kern @@ -1,567 +1,756 @@ - Unix Kernel Modifications for Precision Timekeeping + A Kernel Model for Precision Timekeeping - Revised 3 December 1993 + Revised 3 April 1994 -Note: This information file is included in the distributions for the -SunOS, Ultrix and OSF/1 kernels and in the NTP Version 3 distribution -(xntp3.tar.Z) as the file README.kern. Availability of the kernel -distributions, which involve licensed code, will be announced -separately. The NTP Version 3 distribution can be obtained via anonymous -ftp from louie.udel.edu in the directory pub/ntp. In order to utilize -all features of this distribution, the NTP version number should be 3.3 +Note: This memorandum is a substantial revision of RFC-1589, "A Kernel +Model for Precision Timekeeping," March, 1994. It includes several +changes to the daemon and user interfaces, as well as a new feature +which disciplines the CPU clock oscillator in both time and frequency to +a source of precision time signals. This memorandum is included in the +distributions for the SunOS, Ultrix and OSF/1 kernels and in the NTP +Version 3 distribution (xntp3.v.tar.Z) as the file README.kern, where v +is the version identifier. Availability of the kernel distributions, +which involve licensed code, will be announced separately. The NTP +Version 3 distribution can be obtained via anonymous ftp from +louie.udel.edu in the directory pub/ntp. In order to utilize all +features of this distribution, the NTP version identifier should be 3q or later. +Overview + +This memorandum describes an engineering model which implements a +precision time-of-day function for a generic operating system. The model +is based on the principles of disciplined oscillators and phase-lock +loops (PLL) and frequency-lock loops (FLL) often found in the +engineering literature. It has been implemented in the Unix kernels for +several workstations, including those made by Sun Microsystems and +Digital Equipment. The model changes the way the system clock is +adjusted in time and frequency, as well as provides mechanisms to +discipline its frequency to an external precision timing source. The +model incorporates a generic system-call interface for use with the +Network Time Protocol (NTP) or similar time synchronization protocol. +The NTP Version 3 daemon xntpd operates with this model to provide +synchronization limited in principle only by the accuracy and stability +of the external timing source. + +This memorandum does not obsolete or update any RFC. It does not propose +a standard protocol, specification or algorithm. It is intended to +provoke comment, refinement and implementations for kernels not +considered herein. While a working knowledge of NTP is not required for +an understanding of the design principles or implementation of the +model, it may be helpful in understanding how the model behaves in a +fully functional timekeeping system. The architecture and design of NTP +is described in [MIL91], while the current NTP Version 3 protocol +specification is given in RFC-1305 [MIL92a] and a subset of the +protocol, the Simple Network Time Protocol (SNTP), is given in RFC-1361 +[MIL92c]. + +The model has been implemented in the Unix kernels for three Sun +Microsystems and Digital Equipment workstations. In addition, for the +Digital machines the model provides improved precision to one +microsecond (us). Since these specific implementations involve +modifications to licensed code, they cannot be provided directly. +Inquiries should be directed to the manufacturer's representatives. +However, the engineering model for these implementations, including a +simulator with code segments almost identical to the implementations, +but not involving licensed code, is available via anonymous FTP from +host louie.udel.edu in the directory pub/ntp and compressed tar archive +kernel.tar.Z. The NTP Version 3 distribution can be obtained via +anonymous ftp from the same host and directory in the compressed tar +archive xntp3.3q.tar.Z, where the version number shown as 3.3q may be +adjusted for new versions as they occur. + 1. Introduction -This memo describes modifications to certain SunOS, Ultrix and OSF/1 -kernel software that manage the system clock and timer functions. They -provide improved accuracy and stability through the use of a disciplined -clock interface for use with the Network Time Protocol (NTP) or similar -time-synchronization protocol. In addition, for the DEC 3000 AXP (Alpha) -and DECstation 5000/240 machines, the modifications provide improved -precision within one microsecond (us) (SunOS 4.1.x already does provide -precision to this order). The NTP Version 3 daemon xntpd operates with -these kernel modifications to provide synchronization in principle to -within this order, but in practice this is limited by the short-term -stability of the timer oscillator to within the order of 100 usec. +This memorandum describes a model and programming interface for generic +operating system software that manages the system clock and timer +functions. The model provides improved accuracy and stability for most +computers using the Network Time Protocol (NTP) or similar time +synchronization protocol. This memorandum describes the design +principles and implementations of the model, while related technical +reports discuss the design approach, engineering analysis and +performance evaluation of the model as implemented in Unix kernels for +modern workstations. The NTP Version 3 daemon xntpd operates with these +implementations to provide improved accuracy and stability, together +with diminished overhead in the operating system and network. In +addition, the model supports the use of external timing sources, such as +precision pulse-per-second (PPS) signals and the industry standard IRIG +timing signals. The NTP daemon automatically detects the presence of the +new features and utilizes them when available. -This memo describes the principles behind the design and operation of -the new software. There are three versions: one that operates with the -SunOS 4.1.x kernels, a second that operates with the Ultrix 4.x kernels -and a third that operates with the OSF/1 V1.x kernels. A detailed -description of the variables and algorithms is given in the hope that -similar functionality can be incorporated in Unix kernels for other -machines. The algorithms involve only minor changes to the system clock -and interval timer routines and include interfaces for application -programs to learn the system clock status and certain statistics of the -time-synchronization process. Detailed installation instructions are -given in a companion README.install file included in the kernel -distributions. The kernel software itself is not provided for public -distribution, since it involves licensed code. Detailed instructions on -how to obtain it for either SunOS, Ultrix or OSF/1 will be given -separately. +There are three prototype implementations of the model presented in this +memorandum, one each for the Sun Microsystems SPARCstation with the +SunOS 4.1.x kernel, Digital Equipment DECstation 5000 with the Ultrix +4.x kernel and Digital Equipment 3000 AXP Alpha with the OSF/1 V1.x +kernel. In addition, for the DECstation 5000/240 and 3000 AXP Alpha +machines, a special feature provides improved precision to 1 us (stock +Sun kernels already do provide this precision). Other than improving the +system clock accuracy, stability and precision, these implementations do +not change the operation of existing Unix system calls which manage the +system clock, such as gettimeofday(), settimeofday() and adjtime(); +however, if the new features are in use, the operations of +gettimeofday() and adjtime() can be controlled instead by new system +calls ntp_gettime() and ntp_adjtime() as described below. -The principal feature added to the Unix kernels is to change the way the -system clock is controlled, in order to provide precision time and -frequency adjustments. Another feature utilizes an undocumented bus- -cycle counter in the DEC 3000 AXP and DECstation 5000/240 to provide -precise time to the microsecond. This feature can in principle be used -with any DEC machine that has this counter, although this has not been -verified. The addition of these features does not affect the operation -of existing Unix system calls such as gettimeofday(), settimeofday() and -adjtime(); however, if the new features are in use, the operations of -adjtime() are controlled instead by a new system call ntp_adjtime(). +A detailed description of the variables and algorithms that operate upon +them is given in the hope that similar functionality can be incorporated +in Unix kernels for other machines. The algorithms involve only minor +changes to the system clock and interval timer routines and include +interfaces for application programs to learn the system clock status and +certain statistics of the time synchronization process. Detailed +installation instructions are given in a specific README files included +in the kernel distributions. -Most Unix programs read the system clock using the gettimeofday() system -call, which returns only the system time and timezone data. For some -applications it is useful to know the maximum error of the reported time -due to all causes, including clock reading errors, oscillator frequency -errors and accumulated latencies on the path to a primary reference -source. However, the new software can adjust the system clock to -compensate for its intrinsic frequency error, so that the timing errors -expected in normal operation will usually be much less than the maximum -error. The user application interface includes a new system call -ntp_gettime(), which returns the system time, as well as the maximum -error and estimated error. This interface is intended to support -applications that need such things, including distributed file systems, -multimedia teleconferencing and other real-time applications. The -protocol daemon application interface includes a new system call -ntp_adjtime(), which can be used to read and write kernel variables used -for precision timekeeping, including time and frequency adjustments, -controlling time constant, leap-second warning and related data. - -In this memo, NTP Version 3 and the Unix implementation xntpd are used -as an example application of the new system calls for use by a protocol -daemon. In principle, the new system calls can be used by other -protocols and daemon implementations as well. Even in cases where the +In this memorandum, NTP Version 3 and the Unix implementation xntp3 are +used as an example application of the new system calls for use by a +synchronization daemon. In principle, these system calls can be used by +other protocols and implementations as well. Even in cases where the local time is maintained by periodic exchanges of messages at relatively -long intervals, such as using the NIST Automated Computer Time Service, -the ability to precisely adjust the local clock frequency simplifies the -synchronization procedures and allows the call frequency to be -considerably reduced. +long intervals, such as using the NIST Automated Computer Time Service +[LEV89], the ability to precisely adjust the system clock frequency +simplifies the synchronization procedures and allows the telephone call +frequency to be considerably reduced. -2. Design Principles +2. Design Approach -In order to understand how the new software works, it is useful to -consider how most Unix systems maintain the system time. In the original -design a hardware timer interrupts the kernel at a fixed rate: 100 Hz in -the SunOS kernel, 256 Hz in the Ultrix kernel and 1024 Hz in the OSF/1 -kernel. Since the Ultrix kernel rate does not evenly divide one second -in microseconds, the kernel adds 64 microseconds once each second, so -the timescale consists of 255 advances of 3906 usec plus one of 3970 -usec. Similarly, the OSF/1 kernel adds 576 usec once each second, so its -timescale consists of 1023 advances of 976 usec plus one of 1552 usec. +While not strictly necessary for an understanding or implementation of +the model, it may be helpful to briefly describe how NTP operates to +control the system clock in a client computer. As described in [MIL91], +the NTP protocol exchanges timestamps with one or more peers sharing a +synchronization subnet to calculate the time offsets between peer clocks +and the local clock. These offsets are processed by several algorithms +which refine and combine the offsets to produce an ensemble average, +which is then used to adjust the local clock time and frequency. The +manner in which the local clock is adjusted represents the main topic of +this memorandum. The goal in the enterprise is the most accurate and +stable system clock possible with the available computer hardware and +kernel software. -In all Unix kernels considered in this memo, it is possible to slew the -system clock to a new offset using the standard Unix adjtime() system -call. To do this the clock frequency is changed by adding or subtracting -a fixed amount (tickadj) at each timer interrupt (tick) for a calculated -number of ticks. Since this calculation involves dividing the requested -offset by tickadj, it is possible to slew to a new offset with a -precision only of tickadj, which is usually in the neighborhood of 5 us, -but sometimes much higher. This results in an amortization error which -can accumulate to unacceptable levels, so that special provisions must -be made in the clock adjustment procedures of the protocol daemon. +In order to understand how the new model works, it is useful to review +how most Unix kernels maintain the system clock. In the Unix design a +hardware counter interrupts the kernel at a fixed rate: 100 Hz in the +SunOS kernel, 256 Hz in the Ultrix kernel and 1024 Hz in the OSF/1 +kernel. Since the Ultrix timer interval (reciprocal of the rate) does +not evenly divide one second in microseconds, the kernel adds 64 us once +each second, so the timescale consists of 255 advances of 3906 us plus +one of 3970 us. Similarly, the OSF/1 kernel adds 576 us once each +second, so its timescale consists of 1023 advances of 976 us plus one of +1552 us. -In order to maintain the system clock within specified bounds with this -scheme, it is necessary to call adjtime() on a regular basis. For -instance, let the bound be set at 100 usec, which is a reasonable value -for NTP-synchronized hosts on a local network, and let the onboard -oscillator tolerance be 100 parts-per-million (ppm), which is a -reasonably conservative assumption. This requires that adjtime() be -called at intervals not exceeding 1 second (s), which is in fact what -the unmodified NTP software daemon does. +2.1. Mechanisms to Adjust Time and Frequency -In the new software this scheme is replaced by another that extends the -low-order bits of the system clock to provide very precise clock -adjustments. At each timer interrupt a precisely calibrated quantity is -added to the composite time value and overflows handled as required. The -quantity is computed from the measured clock offset and in addition a -frequency adjustment, which is automatically calculated from previous -time adjustments. This implementation operates as an adaptive-parameter -first-order, type-II, phase-lock loop (PLL), which in principle provides -precision control of the system clock phase to within +-1 us and -frequency to within +-5 nanoseconds (ns) per day. +In most Unix kernels it is possible to slew the system clock to a new +offset relative to the current time by using the adjtime() system call. +To do this the clock frequency is changed by adding or subtracting a +fixed amount (tickadj) at each timer interrupt (tick) for a calculated +number of timer interrupts. Since this calculation involves dividing the +requested offset by tickadj, it is possible to slew to a new offset with +a precision only of tickadj, which is usually in the neighborhood of 5 +us, but sometimes much larger. This results in a roundoff error which +can accumulate to an unacceptable degree, so that special provisions +must be made in the clock adjustment procedures of the synchronization +daemon. -This PLL model is identical to the one implemented in NTP, except that -in NTP the software daemon has to simulate the PLL using only the -original adjtime() system call. The daemon is considerably complicated -by the need to parcel time adjustments at frequent intervals in order to -maintain the accuracy to specified bounds. The modified kernel routines -do this directly, allowing vast gobs of ugly daemon code to be avoided -at the expense of only a small amount of new code in the kernel. In -fact, the amount of code added to the kernel for the new scheme is about -the amount needed to implement the old scheme. A new system call -ntp_adjtime(), which operates in a way similar to the original -adjtime(), is called only as each new time update is determined, which -in NTP occurs at intervals of from 16 s to 1024 s. In addition, doing -the frequency correction in the kernel means that the system time runs -true even if the daemon were to cease operation or the network paths to -the primary reference source fail. The addition of the new ntp_adjtime() -system call does not affect the original adjtime() system call, which -continues to operate in its traditional fashion. However, the two system -calls canot be used at the same time; only one of the two should be used -on any given system. +In order to implement a frequency discipline function, it is necessary +to provide time offset adjustments to the kernel at regular adjustment +intervals using the adjtime() system call. In order to reduce the system +clock jitter to the regime consistent with the model, it is necessary +that the adjustment interval be relatively small, in the neighborhood of +1 s. However, the Unix adjtime() implementation requires each offset +adjustment to complete before another one can be begun, which means that +large adjustments must be amortized over possibly many adjustment +intervals. The requirement to implement the adjustment interval and +compensate for roundoff error considerably complicates the synchronizing +daemon implementation. -It is the intent in the design that settimeofday() be used for changes -in system time greater than +-128 ms. It has been the Internet -experience that the need to change the system time in increments greater -than +-128 milliseconds is extremely rare and is usually associated with -a hardware or software malfunction or system reboot. Once the system -clock has been set in this way, the ntp_adjtime() system call is used to -provide periodic updates including the time offset, maximum error, -estimated error and PLL time constant. With NTP the update interval -depends on the measured error and time constant; however, the scheme is -quite forgiving and neither moderate loss of updates nor variations in -the length of the polling interval are serious. +In the new model this scheme is replaced by another that represents the +system clock as a multiple-word, precision-time variable in order to +provide very precise clock adjustments. At each timer interrupt a +precisely calibrated quantity is added to the kernel time variable and +overflows propagated as required. The quantity is computed as in the NTP +local clock model described in [MIL92b], which operates as an adaptive- +parameter, first-order, type-II phase-lock loop (PLL). In principle, +this PLL design can provide precision control of the system clock +oscillator within 1 us and frequency to within parts in 10^11. While +precisions of this order are surely well beyond the capabilities of the +CPU clock oscillator used in typical workstations, they are appropriate +using precision external oscillators, as described below. -In addition, the kernel adjusts the maximum error to grow by an amount -equal to the oscillator frequency tolerance times the elapsed time since -the last update. The default engineering parameters have been optimized -for intervals not greater than about 16 s. For longer intervals the PLL -time constant can be adjusted to optimize the dynamic response up to -intervals of 1024 s. Normally, this is automatically done by NTP. In any -case, if updates are suspended, the PLL coasts at the frequency last +The PLL design is identical to the one originally implemented in NTP and +described in [MIL92b]. In the original design the software daemon +simulates the PLL using the adjtime() system call; however, the daemon +implementation is considerably complicated by the considerations +described above. The modified kernel routines implement the PLL in the +kernel using precision time and frequency representations, so that these +complications are avoided. A new system call ntp_adjtime() is called +only as each new time update is determined, which in NTP occurs at +intervals of from 16 s to 1024 s. In addition, doing frequency +compensation in the kernel means that the system clock runs true even if +the daemon were to cease operation or the network paths to the primary +synchronization source fail. + +In the new model the new ntp_adjtime() operates in a way similar to the +original adjtime() system call, but does so independently of adjtime(), +which continues to operate in its traditional fashion. When used with +NTP, it is the design intent that settimeofday() or adjtime() be used +only for system clock adjustments greater than +-128 ms, although the +dynamic range of the new model is much larger at +-512 ms. It has been +the Internet experience that the need to change the system clock in +increments greater than +-128 ms is extremely rare and is usually +associated with a hardware or software malfunction or system reboot. + +The easiest way to set the time is with the settimeofday() system call; +however, this can under some conditions cause the clock to jump +backwards. If this cannot be tolerated, adjtime() can be used to slew +the clock to the new value without running backward or affecting the +frequency discipline process. Once the system clock has been set within ++-128 ms, the ntp_adjtime() system call is used to provide periodic +updates including the time offset, maximum error, estimated error and +PLL time constant. With NTP the update interval and time constant depend +on the measured delay and dispersion; however, the scheme is quite +forgiving and neither moderate loss of updates nor variations in the +update interval are serious. + +2.2 Daemon and Application Interface + +Unix application programs can read the system clock using the +gettimeofday() system call, which returns only the system time and +timezone data. For some applications it is useful to know the maximum +error of the reported time due to all causes, including clock reading +errors, oscillator frequency errors and accumulated latencies on the +path to the primary synchronization source. However, in the new model +the PLL adjusts the system clock to compensate for its intrinsic +frequency error, so that the time error expected in normal operation +will usually be much less than the maximum error. The programming +interface includes a new system call ntp_gettime(), which returns the +system time, as well as the maximum error and estimated error. This +interface is intended to support applications that need such things, +including distributed file systems, multimedia teleconferencing and +other real-time applications. The programming interface also includes a +new system call ntp_adjtime(), which can be used to read and write +kernel variables for time and frequency adjustment, PLL time constant, +leap-second warning and related data. + +In addition, the kernel adjusts the indicated maximum error to grow by +an amount equal to the maximum oscillator frequency tolerance times the +elapsed time since the last update. The default engineering parameters +have been optimized for update intervals in the order of 64 s. As shown +in [MIL93], this is near the optimum interval for NTP used with ordinary +room-temperature quartz oscillators. For other intervals the PLL time +constant can be adjusted to optimize the dynamic response over intervals +of 16-1024 s. Normally, this is automatically done by NTP. In any case, +if updates are suspended, the PLL coasts at the frequency last determined, which usually results in errors increasing only to a few -tens of milliseconds over a day. +tens of milliseconds over a day using typical modern workstations. -The new code needs to know the initial frequency offset and time -constant for the PLL, and the daemon needs to know the current frequency -offset computed by the kernel for monitoring purposes. These data are -exchanged between the kernel and protocol daemon using ntp_adjtime() as -documented later in this memo. Provisions are made to exchange related -timing information, such as the maximum error and estimated error, -between the kernel and daemon and between the kernel and application -programs. - -In the DEC 3000 AXP, DECstation 5000/240 and possibly other DEC -machines there is an undocumented hardware register that counts system -bus cycles at a rate of 25 MHz. The new kernel microtime() routine tests -for the CPU type and, in the case of these machines, use this register -to interpolate system time between hardware timer interrupts. This -results in a precision of +-1 us for all time values obtained via the -gettimeofday() and ntp_gettime() system calls. These routines call the -microtime() routine, which returns the actual interpolated value but -does not change the kernel time variable. Therefore, other kernel -routines that access the kernel time variable directly and do not call -either gettimeofday(), ntp_gettime() or microtime() will continue their -present behavior. The microtime() feature is independent of other -features described here and is operative even if the kernel PLL or new -system calls have not been implemented. - -While any protocol daemon can in principle be modified to use the new -system calls, the most likely will be users of the NTP Version 3 daemon -xntpd. The xntpd code determines whether the new system calls are +While any synchronization daemon can in principle be modified to use the +new system calls, the most likely will be users of the NTP Version 3 +daemon xntpd. The xntpd code determines whether the new system calls are implemented and automatically reconfigures as required. When -implemented, the daemon reads the frequency offset from a file and -provides it and the initial time constant via ntp_adjtime(). In -subsequent calls to ntp_adjtime(), only the time adjustment and time +implemented, the daemon reads the frequency offset from a system file +and provides it and the initial time constant via ntp_adjtime(). In +subsequent calls to ntp_adjtime(), only the time offset and time constant are affected. The daemon reads the frequency from the kernel -using ntp_adjtime() at intervals of about one hour and writes it to the -system log file. This information is recovered when the daemon is -restarted after reboot, for example, so the sometimes extensive training -period to learn the frequency separately for each system can be avoided. +using ntp_adjtime() at intervals of about one hour and writes it to a +system file. This information is recovered when the daemon is restarted +after reboot, for example, so the sometimes extensive training period to +learn the frequency separately for each oscillator can be avoided. -3. Kernel Interfaces +2.3. Precision Clocks for DECstation 5000/240 and 3000 AXP Alpha -This section describes the kernel interfaces to the protocol daemon and -user applications. The ideas are based on suggestions from Jeff Mogul -and Philip Gladstone and a similar interface designed by the latter. It -is important to point out that the functionality of the original Unix -adjtime() system call is preserved, so that the modified kernel will -work as the unmodified one should the kernel PLL not be in use. In this -case the ntp_adjtime() system call can still be used to read and write -kernel variables that might be used by a protocol daemon other than NTP, -for example. +The stock microtime() routine in the Ultrix kernel for Digital Equipment +MIPS-based workstations returns system time to the precision of the +timer interrupt interval, which is in the 1-4 ms range. However, in the +DECstation 5000/240 and possibly other machines of that family, there is +an undocumented IOASIC hardware register that counts system bus cycles +at a rate of 25 MHz. The new microtime() routine for the Ultrix kernel +uses this register to interpolate system time between timer interrupts. +This results in a precision of 1 us for all time values obtained via the +gettimeofday() and ntp_gettime() system calls. For the Digital Equipment +3000 AXP Alpha, the architecture provides a hardware Process Cycle +Counter and a machine instruction (rpcc) to read it. This counter +operates at the fundamental frequency of the CPU clock or some +submultiple of it, 133.333 MHz for the 3000/400 for example. The new +microtime() routine for the OSF/1 kernel uses this counter in the same +fashion as the Ultrix routine. Support for this feature is conditionally +compiled in the kernel only if the MICRO option is used in the kernel +configuration file. -3.1. The ntp_gettime() System Call +In both the Ultrix and OSF/1 kernels the gettimeofday() and +ntp_gettime() system call use the new microtime() routine, which returns +the interpolated value to 1-us resolution, but does not change the +kernel time variable. Therefore, other routines that access the kernel +time variable directly and do not call either gettimeofday(), +ntp_gettime() or microtime() will continue their present behavior. The +microtime() feature is independent of other features described here and +is operative even if the kernel PLL or new system calls have not been +implemented. -The syntax and semantics of the ntp_gettime() call are given in the -following fragment of the timex.h header file. This file is identical in -the SunOS, Ultrix and OSF/1 kernel distributions. Note that the timex.h -file calls the syscall.h system header file, which must be modified to -define the SYS_ntp_gettime system call specific to each system type. The -kernel distributions include directions on how to do this. +The SunOS kernel already includes a system clock with 1-us resolution; +so, in principle, no microtime() routine is necessary. An existing +kernel routine uniqtime() implements this function, but it is coded in +the C language and is rather slow at 42-85 us per call on a SPARCstation +IPC. A replacement microtime() routine coded in assembler language is +available in the NTP Version 3 distribution and is much faster at about +3 us per call. Note that, as explained later, this routine should be +called at an interrupt priority level not greater than that of the timer +interrupt routine. Otherwise, it is possible to miss a tick increment, +with result the time returned can be late by one tick. This is always +true in the case of gettimeofday() and ntp_gettime(), but might not be +true in other cases, such as when using the PPS signal described later +in this memorandum. -/* - * This header file defines the Network Time Protocol (NTP) interfaces - * for user and daemon application programs. These are implemented using - * private system calls and data structures and require specific kernel - * support. - * - * NAME - * ntp_gettime - NTP user application interface - * - * SYNOPSIS - * #include - * - * int system call(SYS_ntp_gettime, tptr) - * - * int SYS_ntp_gettime defined in syscall.h header file - * struct ntptimeval *tptr pointer to ntptimeval structure - * - * NTP user interface - used to read kernel clock values - * Note: maximum error = NTP synch distance = dispersion + delay / 2; - * estimated error = NTP dispersion. - */ -struct ntptimeval { - struct timeval time; /* current time */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ -}; +2.4. External Time and Frequency Discipline -The ntp_gettime() system call returns three values in the ntptimeval -structure: the current time in unix timeval format plus the maximum and -estimated errors in microseconds. While the 32-bit long data type limits -the error quantities to something more than an hour, in practice this is -not significant, since the protocol itself will declare an -unsynchronized condition well below that limit. If the protocol computes -either of these values in excess of 16 seconds, they are clamped to that -value and the local clock declared unsynchronized. +The overall accuracy of a time synchronization subnet with respect to +Coordinated Universal Time (UTC) depends on the accuracy and stability +of the primary synchronization source, usually a radio or satellite +receiver, and the CPU clock oscillator of the primary server. As +discussed in [MIL93], the traditional interface using a ASCII serial +timecode and RS232 port precludes the full accuracy of most radio +clocks. In addition, the poor frequency stability of typical CPU clock +oscillators limits the accuracy, whether or not precision time sources +are available. There are, however, several ways in which the system +clock accuracy and stability can be improved to the degree limited only +by the accuracy and stability of the synchronization source and the +jitter of the interface and operating system. -Following is a detailed description of the ntptimeval structure members. +Many radio clocks produce special signals that can be used by external +equipment to precisely synchronize time and frequency. Most produce a +pulse-per-second (PPS) signal that can be read via a modem-control lead +of a serial port and some produce a special IRIG signal that can be read +directly by a bus peripheral, such as the KSI/Odetics TPRO IRIG SBus +interface, or indirectly via the audio codec of some workstations, as +described in [MIL93]. In the NTP Version 3 daemon xntpd, the PPS signal +can be used to augment the less precise ASCII serial timecode to improve +accuracy to the order of a few tens of microseconds. Support is also +included in the NTP distribution for the TPRO interface, as well as the +audio codec; however, the latter requires a modified kernel audio driver +contained in the compressed tar archive bsd_audio.tar.Z in the same host +and directory as the NTP Version 3 distribution mentioned previously. +2.4.1. PPS Signal -struct timeval time; +The most convenient way to interface a PPS signal to a computer is +usually with a serial port and RS232-compatible signal; however, the PPS +signal produced by most radio clocks and laboratory instruments is +usually a TTL pulse signal. Therefore, some kind of level +converter/pulse generator is necessary to adapt the PPS signal to a +serial port. An example design, including schematic and printed-circuit +board artwork, is in the compressed tar archive gadget.tar.Z in the same +host and directory as the NTP Version 3 distribution mentioned +previously. There are several ways the PPS signal can be used in +conjunction with the NTP Version 3 daemon xntpd, as described in [MIL93] +and in the documentation included in the distribution. - This member is set to the current system time, expressed as a Unix - timeval structure. The timeval structure consists of two 32-bit - words, one for the number of seconds past 1 January 1970 and the - other the number of microseconds past the most recent second's - epoch. +The NTP Version 3 distribution includes a special ppsclock module for +the SunOS 4.1.x kernel that captures the PPS signal presented via a +modem-control lead of a serial port. Normally, the ppsclock module +produces a timestamp at each transition of the PPS signal and provides +it to the synchronization daemon for integration with the serial ASCII +timecode, also produced by the radio clock. With the conventional PLL +implementation in either the daemon or the kernel as described in +[MIL93], the accuracy of this scheme is limited by the intrinsic +stability of the CPU clock oscillator to a millisecond or two, depending +on environmental temperature variations. -long maxerror; +The ppsclock module has been modified to in addition call a new kernel +routine hardpps() once each second. In addition, the Ultrix 4.3 kernel +has been modified to provide a similar functionality. The hardpps() +routine compares the timestamp with a sample of the CPU clock oscillator +in order to discipline the oscillator to the time and frequency of the +PPS signal. Using this method, the time accuracy is improved to +typically 20 us or less and frequency stability a few parts in 10^8, +which is about two orders of magnitude better than the undisciplined +oscillator. The new feature is conditionally compiled in the code +described below only if the PPS_SYNC option is used in the kernel +configuration file. - This member is set to the value of the time_maxerror kernel - variable, which establishes the maximum error of the indicated time - relative to the primary reference source, in microseconds. This - variable can also be set and read by the ntp_adjtime() system call. - For NTP, the value is determined as the synchronization distance, - which is equal to the root dispersion plus one-half the root delay. - It is increased by a small amount (time_tolerance) each second to - reflect the clock frequency tolerance. This variable is computed by - the time-synchronization daemon and the kernel and returned in a - ntp_gettime() system call, but is otherwise not used by the kernel. +When using the PPS signal to adjust the time, there is a problem with +some kernels which is very difficult to fix. The serial port interrupt +routine often operates at an interrupt priority level above the timer +interrupt routine. Thus, as explained below, it is possible that a tick +increment can be missed and the time returned late by one tick. It may +happen that, if the CPU clock oscillator frequency is close to the PPS +oscillator frequency (less than a few ppm), this condition can persist +for two or more successive PPS interrupts. A useful workaround in the +code is to use a glitch detector and median filter to process the PPS +sample offsets. The glitch detector suppresses offset bursts greater +than half the tick interval and which last less than 30 successive PPS +interrupts. The median filter ranks the offsets in a moving window of +three samples and uses the median as the output and the difference +between the other two as a dispersion measure. -long esterror; +2.4.2. External Clocks - This member is set to the value of the time_esterror kernel - variable, which establishes the expected error of the indicated - time relative to the primary reference source, in microseconds. - This variable can also be set and read by the ntp_adjtime() system - call. For NTP, the value is determined as the root dispersion, - which represents the best estimate of the actual error of the - system clock based on its past behavior, together with observations - of multiple clocks within the peer group. This variable is computed - by the time-synchronization daemon and returned in a ntp_gettime() - system call, but is otherwise not used by the kernel. +It is possible to replace the system clock function with an external bus +peripheral. The TPRO device mentioned previously can be used to provide +IRIG-synchronized time with a precision of 1 us. A driver for this +device tprotime.c and header file tpro.h are included in the +kernel.tar.Z distribution mentioned previously. Using this device, the +system clock is read directly from the interface; however, the device +does not record the year, so special provisions have been made to obtain +the year from the kernel time variable and initialize the driver +accordingly. Support for this feature is conditionally compiled in the +kernel only if the EXT_CLOCK and TPRO options are used in the kernel +configuration file. -3.2. The ntp_adjtime() System Call +While the system clock function is provided directly by the microtime() +routine in the driver, the kernel time variable must be disciplined as +well, since not all system timing functions use the microtime() routine. +This is done by measuring the time difference between the microtime() +clock and kernel time variable and using it to adjust the kernel PLL as +if the adjustment were provided by an external peer and NTP. -The syntax and semantics of the ntp_adjtime() call is given in the -following fragment of the timex.h header file. Note that, as in the -ntp_gettime() system call, the the syscall.h system header file must be -modified to define the SYS_ntp_adjtime system call specific to each -system type. +A good deal of error checking is done in the TPRO driver, since the +system clock is vulnerable to a misbehaving radio clock, IRIG signal +source, interface cables and TPRO device itself. Unfortunately, there is +no practical way to utilize the extensive diversity and redundancy +capabilities available in the NTP synchronization daemon. In order to +avoid disruptions that might occur if the TPRO time is far different +from the kernel time variable, the latter is used instead of the former +if the difference between the two exceeds 1000 s; presumably in that +case operator intervention is required. -/* - * NAME - * ntp_adjtime - NTP daemon application interface - * - * SYNOPSIS - * #include - * - * int system call(SYS_ntp_adjtime, mode, tptr) - * - * int SYS_ntp_adjtime defined in syscall.h header file - * struct timex *tptr pointer to timex structure - * - * NTP daemon interface - used to discipline kernel clock oscillator - */ -struct timex { - int mode; /* mode selector */ - long offset; /* time offset (usec) */ - long frequency; /* frequency offset (scaled ppm) */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ - int status; /* clock command/status */ - long time_constant; /* pll time constant */ - long precision; /* clock precision (usec) (read only) */ - long tolerance; /* clock frequency tolerance (ppm) - * (read only) - */ -}; +2.4.2. External Oscillators -The ntp_adjtime() system call is used to read and write certain time- -related kernel variables summarized in this and subsequent sections. -Writing these variables can only be done in superuser mode. To write a -variable, the mode structure member is set with one or more bits, one of -which is assigned each of the following variables in turn. The current -values for all variables are returned in any case; therefore, a mode -argument of zero means to return these values without changing anything. +Even if a source of PPS or IRIG signals is not available, it is still +possible to improve the stability of the system clock through the use of +a specialized bus peripheral. In order to explore the benefits of such +an approach, a special SBus peripheral called HIGHBALL has been +constructed. The device includes a pair of 32-bit hardware counters in +Unix timeval format, together with a precision, oven-controlled quartz +oscillator with a stability of a few parts in 10^9. A driver for this +device hightime.c and header file high.h are included in the +kernel.tar.Z distribution mentioned previously. Support for this feature +is conditionally compiled in the kernel only if the EXT_CLOCK and +HIGHBALL options are used in the kernel configuration file. -Following is a description of the timex structure members. +Unlike the external clock case, where the system clock function is +provided directly by the microtime() routine in the driver, the HIGHBALL +counter offsets with respect to UTC must be provided first. This is done +using the ordinary kernel PLL, but controlling the counter offsets +directly, rather than the kernel time variable. At first, this might +seem to defeat the purpose of the design, since the jitter and wander of +the synchronization source will affect the counter offsets and thus the +accuracy of the time. However, the jitter is much reduced by the PLL and +the wander is small, especially if using a radio clock or another +primary server disciplined in the same way. In practice, the scheme +works to reduce the incidental wander to a few parts in 10^8, or about +the same as using the PPS signal. -int mode; +As in the previous case, the kernel time variable must be disciplined as +well, since not all system timing functions use the microtime() routine. +However, the kernel PLL cannot be used for this, since it is already in +use providing offsets for the HIGHBALL counters. Therefore, a special +correction is calculated from the difference between the microtime() +clock and the kernel time variable and used to adjust the kernel time +variable at the next timer interrupt. This somewhat roundabout approach +is necessary in order that the adjustment does not cause the kernel time +variable to jump backwards and possibly lose or duplicate a timer event. - This is a bit-coded variable selecting one or more structure - members, with one bit assigned each member. If a bit is set, the - value of the associated member variable is copied to the - corresponding kernel variable; if not, the member is ignored. The - bits are assigned as given in the following fragment of the timex.h - header file. Note that the precision and tolerance are intrinsic - properties of the kernel configuration and cannot be changed. +2.5 Other Features - /* - * Mode codes (timex.mode) - */ - #define ADJ_OFFSET 0x0001 /* time offset */ - #define ADJ_FREQUENCY 0x0002 /* frequency offset */ - #define ADJ_MAXERROR 0x0004 /* maximum time error */ - #define ADJ_ESTERROR 0x0008 /* estimated time error */ - #define ADJ_STATUS 0x0010 /* clock status */ - #define ADJ_TIMECONST 0x0020 /* pll time constant */ +It is a design feature of the NTP architecture that the system clocks in +a synchronization subnet are to read the same or nearly the same values +before during and after a leap-second event, as declared by national +standards bodies. The new model is designed to implement the leap event +upon command by an ntp_adjtime() argument. The intricate and sometimes +arcane details of the model and implementation are discussed in [MIL92b] +and [MIL93]. Further details are given in the technical summary later in +this memorandum. +3. Technical Summary -long offset; +In order to more fully understand the workings of the model, a stand- +alone simulator kern.c and header file timex.h are included in the +kernel.tar.Z distribution mentioned previously. In addition, an example +kernel module kern_ntptime.c which implements the ntp_gettime() and +ntp_adjtime() system calls is included. Neither of these programs +incorporate licensed code. Since the distribution is somewhat large, due +to copious comments and ornamentation, it is impractical to include a +listing of these programs in this memorandum. In any case, implementors +may choose to snip portions of the simulator for use in new kernel +designs; but, due to formatting conventions, this would be difficult if +included in this memorandum. - If selected, this member (scaled) replaces the value of the - time_offset kernel variable, which defines the current time offset - of the phase-lock loop. The value must be in the range +-512 ms in - the present implementation. If so, the clock status is - automatically set to TIME_OK. +The kern.c program is an implementation of an adaptive-parameter, first- +order, type-II phase-lock loop. The system clock is implemented using a +set of variables and algorithms defined in the simulator and driven by +explicit offsets generated by the main() routine in the program. The +algorithms include code fragments almost identical to those in the +machine-specific kernel implementations and operate in the same way, but +the operations can be understood separately from any licensed source +code into which these fragments may be integrated. The code fragments +themselves are not derived from any licensed code. The following +discussion assumes that the simulator code is available for inspection. -long time_constant; +3.1. PLL Simulation - If selected, this member replaces the value of the time_constant - kernel variable, which establishes the bandwidth of "stiffness" of - the kernel PLL. The value is used as a shift, with the effective - PLL time constant equal to a multiple of (1 << time_constant), in - seconds. The optimum value for the time_constant variable is - log2(update_interval) - 4, where update_interval is the nominal - interval between clock updates, in seconds. With an ordinary crystal - oscillator the optimum value for time_constant is about 2, giving - an update_interval of 4 (64 s). Values of time_constant between zero - and 2 can be used if quick convergence is necessary; values between - 2 and 6 can be used to reduce network load, but at a modest cost in - accuracy. Values above 6 are appropriate only if a precision - oscillator is available. +The simulator operates in conformance with the analytical model +described in [MIL92b]. The main() program operates as a driver for the +fragments hardupdate(), hardclock(), second_overflow(), hardpps() and +microtime(), although not all functions implemented in these fragments +are simulated. The program simulates the PLL at each timer interrupt and +prints a summary of critical program variables at each time update. -long frequency; +There are three defined options in the kernel configuration file +specific to each implementation. The PPS_SYNC option provides support +for a pulse-per-second (PPS) signal, which is used to discipline the +frequency of the CPU clock oscillator. The EXT_CLOCK option provides +support for an external kernel-readable clock, such as the KSI/Odetics +TPRO IRIG interface or HIGHBALL precision oscillator, both for the SBus. +The TPRO option provides support for the former, while the HIGHBALL +option provides support for the latter. External clocks are implemented +as the microtime() clock driver, with the specific source code selected +by the kernel configuration file. - If selected, this member (scaled) replaces the value of the - time_frequency kernel variable, which establishes the intrinsic - frequency of the local clock oscillator. This variable is scaled by - (1 << SHIFT_USEC) in parts-per-million (ppm), giving it a maximum - value of about +-31 ms/s and a minimum value (frequency resolution) - of about 2e-11, which is appropriate for even the best quartz - oscillator. +The PPS signal is carefully monitored for error conditions which can +affect accuracy, stability and reliability. The time_status kernel +variable contains bits that both control the use of the PPS signal and +reveal its operational status. The function of each bit is described in +a later section of this memo. -long maxerror; +3.1.1. The hardupdate() Fragment - If selected, this member replaces the value of the time_maxerror - kernel variable, which establishes the maximum error of the - indicated time relative to the primary reference source, in - microseconds. This variable can also be read by the ntp_gettime() - system call. For NTP, the value is determined as the - synchronization distance, which is equal to the root dispersion - plus one-half the root delay. It is increased by a small amount - (time_tolerance) each second to reflect the clock frequency - tolerance. This variable is computed by the time-synchronization - daemon and the kernel and returned in a ntp_gettime() system call, - but is otherwise not used by the kernel. +The hardupdate() fragment is called by ntp_adjtime() as each update is +computed to adjust the system clock phase and frequency. Note that the +time constant is in units of powers of two, so that multiplies can be +done by simple shifts. The phase variable is computed as the offset +divided by the time constant, but clamped to a maximum (for robustness). +Then, the time since the last update is computed and clamped to a +maximum and to zero if initializing. The offset is multiplied (sorry +about the ugly multiply) by the result and divided by the square of the +time constant and then added to the frequency variable. Note that all +shifts are assumed to be positive and that a shift of a signed quantity +to the right requires a little dance. -long esterror; +The STA_PLL and STA_PPSTIME status bits, which are set by the +ntp_adjtime() system call, serve to enable or inhibit the kernel PLL and +PPS time-discipline functions. The STA_PPSSIGNAL status bit is set by +the hardpps() code fragment when the PPS signal is present and operating +within nominal bounds. Time discipline from the PPS signal operates only +if both the STA_PPSTIME and STA_PPSSIGNAL bits are set; otherwise, the +discipline operates from the offset given in the ntp_adjtime() system +call. In the intended mode of operation, the synchronization daemon sets +STA_PLL to enable the PLL when first initialized, then sets STA_PPSTIME +when reliable synchronization to within +-128 ms has been achieved with +either a radio clock or external peer. The daemon can detect and +indicate this condition for monitoring purposes by noting that both +STA_PPSTIME and STA_PPSSIGNAL are set. - If selected, this member replaces the value of the time_esterror - kernel variable, which establishes the expected error of the - indicated time relative to the primary reference source, in - microseconds. This variable can also be read by the ntp_gettime() - system call. For NTP, the value is determined as the root - dispersion, which represents the best estimate of the actual error - of the system clock based on its past behavior, together with - observations of multiple clocks within the peer group. This - variable is computed by the time-synchronization daemon and - returned in a ntp_gettime() system call, but is otherwise not used - by the kernel. - -int status; - - If selected, this member replaces the value of the time_status - kernel variable, which records whether the clock is synchronized, - waiting for a leap second, etc. In order to set this variable - explicitly, either (a) the current clock status is TIME_OK or (b) - the member value is TIME_BAD; that is, the ntp_adjtime() call can - always set the clock to the unsynchronized state or, if the clock - is running correctly, can set it to any state. In any case, the - ntp_adjtime() call always returns the current state in this member, - so the caller can determine whether or not the request succeeded. - -long precision; - - This member is set equal to the time_precision kernel in - microseconds variable upon return from the system call. The - time_precision variable cannot be written. This variable represents - the maximum error in reading the system clock, which is ordinarily - equal to the kernel variable tick, 10000 usec in the SunOS kernel, - 3906 usec in Ultrix kernel and 976 usec in the OSF/1 kernel. - However, in cases where the time can be interpolated with - microsecond resolution, such as in the SunOS kernel and modified - Ultrix and OSF/1 kernels, the precision is specified as 1 usec. - This variable is computed by the kernel for use by the time- - synchronization daemon, but is otherwise not used by the kernel. - -long tolerance; - - This member is set equal to the time_tolerance kernel variable in - parts-per-million (ppm) upon return from the system call. The - time_tolerance variable cannot be written. This variable represents - the maximum frequency error or tolerance of the particular platform - and is a property of the architecture and manufacturing process. - -3.3. Command/Status Codes - -The kernel routines use the system clock status variable time_status, -which records whether the clock is synchronized, waiting for a leap -second, etc. The value of this variable is returned as the result code -by both the ntp_gettime() and ntp_adjtime() system calls. In addition, -it can be explicitly read and written using the ntp_adjtime() system -call, but can be written only in superuser mode. Values presently -defined in the timex.h header file are as follows: - -/* - * Clock command/status codes (timex.status) - */ -#define TIME_OK 0 /* clock synchronized */ -#define TIME_INS 1 /* insert leap second */ -#define TIME_DEL 2 /* delete leap second */ -#define TIME_OOP 3 /* leap second in progress */ -#define TIME_BAD 4 /* clock not synchronized */ - -A detailed description of these codes as used by the leap-second state -machine is given later in this memo. In case of a negative result code, -the kernel has intercepted an invalid address or (in case of the -ntp_adjtime() system call), a superuser violation. - -4. Technical Summary - -In order to more fully understand the workings of the PLL, a stand-alone -simulator kern.c is included in the kernel distributions. This is an -implementation of an adaptive-parameter, first-order, type-II phase-lock -loop. The system clock is implemented using a set of variables and -algorithms defined in the simulator and driven by explicit offsets -generated by the simulator. The algorithms include code fragments -identical to those in the modified kernel routines and operate in the -same way, but the operations can be understood separately from any -licensed source code into which these fragments may be integrated. The -code segments themselves are not derived from any licensed code. - -4.1. PLL Simulation - -In the simulator the hardupdate() fragment is called by ntp_adjtime() as -each update is computed to adjust the system clock phase and frequency. -Note that the time constant is in units of powers of two, so that -multiplies can be done by simple shifts. The phase variable is computed -as the offset multiplied by the time constant. Then, the time since the -last update is computed and clamped to a maximum (for robustness) and to -zero if initializing. The offset is multiplied (sorry about the ugly -multiply) by the result and by the square of the time constant and then -added to the frequency variable. Finally, the frequency variable is -clamped not to exceed the tolerance. Note that all shifts are assumed to -be positive and that a shift of a signed quantity to the right requires -a little dance. - -With the defines given, the maximum time offset is determined by the -size in bits of the long type (32) less the SHIFT_UPDATE scale factor or -18 bits (signed). The scale factor is chosen so that there is no loss of -significance in later steps, which may involve a right shift up to 14 -bits. This results in a maximum offset of about +-130 ms. Since +With the defines given in the program and header files, the maximum time +offset is determined by the size in bits of the long type (32 or 64) +less the SHIFT_UPDATE scale factor (12) or at least 20 bits (signed). +The scale factor is chosen so that there is no loss of significance in +later steps, which may involve a right shift up to SHIFT_UPDATE bits. +This results in a time adjustment range over +-512 ms. Since time_constant must be greater than or equal to zero, the maximum -frequency offset is determined by the SHIFT_KF (20) scale factor, or -about +-130 ppm. In the addition step, the value of offset * mtemp is -represented in 18 + 10 = 28 bits, which will not overflow a long add. -There could be a loss of precision due to the right shift of up to eight -bits, since time_constant is bounded at 6. This results in a net worst- -case frequency error of about 2^-16 us or well down into the oscillator -phase noise. While the time_offset value is assumed checked before -entry, the time_phase variable is an accumulator, so is clamped to the -tolerance on every call. This helps to damp transients before the -oscillator frequency has been determined, as well as to satisfy the -correctness assertions if the time-synchronization protocol comes -unstuck. +frequency offset is determined by the SHIFT_USEC scale factor (16) or at +least 16 bits (signed). This results in a frequency adjustment range +over +-31,500 ppm. + +In the addition step, the value of offset * mtemp is not greater than +MAXPHASE * MAXSEC = 31 bits (signed), which will not overflow a long add +on a 32-bit machine. There could be a loss of precision due to the right +shift of up to 12 bits, since time_constant is bounded at 6. This +results in a net worst-case frequency resolution of about .063 ppm, +which is not significant for most quartz oscillators. The worst case +could be realized only if the NTP peer misbehaves according to the +protocol specification. + +The time_offset value is clamped upon entry. The time_phase variable is +an accumulator, so is clamped to the tolerance on every call. This helps +to damp transients before the oscillator frequency has been stabilized, +as well as to satisfy the correctness assertions if the time +synchronization protocol or implementation misbehaves. + +3.1.2. The hardclock() Fragment The hardclock() fragment is inserted in the hardware timer interrupt -routine at the point the system clock is to be incremented. Previous to -this fragment the time_update variable has been initialized to the value -computed by the adjtime() system call in the stock Unix kernel, normally -the value of tick plus/minus the tickadj value, which is usually in the -order of 5 microseconds. When the kernel PLL is in use, adjtime() is -not, so the time_update value at this point is the value of tick. This -value, the phase adjustment (time_adj) and the clock phase (time_phase) -are summed and the total tested for overflow of the microsecond. If an -overflow occurs, the microsecond (tick) is incremented or decremented, -depending on the sign of the overflow. +routine at the point the system clock is to be incremented by the value +of tick. Previous to this fragment the time_update variable has been +initialized to the tick increment plus the value computed by the +adjtime() system call in the stock Unix kernel, normally plus/minus the +tickadj value, which is usually in the order of 5 us. The time_phase +variable, which represents the instantaneous phase of the system clock, +is advanced by time_adj, which is calculated in the second_overflow() +fragment described below. If the value of time_phase exceeds 1 us in +scaled units, time_update is increased by the (signed) excess and +time_phase retains the residue. + +In those cases where a PPS signal is connected by a serial port +operating at an interrupt priority level greater than the timer +interrupt, special consideration should be given the location of the +hardclock() fragment in the timer interrupt routine. The system clock +should be advanced as early in the routine as possible, preferably +before the hardware timer interrupt flag is cleared. This reduces or +eliminates the possibility that the microtime() routine may latch the +time after the flag is cleared, but before the system clock is advanced, +which results in a returned time late by one tick. + +Except in the case of an external oscillator such as the HIGHBALL +interface, the hardclock() fragment advances the system clock by the +value of tick plus time_update. However, in the case of an external +oscillator, the system clock is obtained directly from the interface and +time_update used to discipline that interface instead. However, the +system clock must still be disciplined as explained previously, so the +value of clock_cpu computed by the second_overflow() fragment is used +instead. + +3.1.3. The second_overflow() Fragment The second_overflow() fragment is inserted at the point where the microseconds field of the system time variable is being checked for -overflow. On rollover of the second the maximum error is increased by -the tolerance and the time offset is divided by the phase weight -(SHIFT_KG) and time constant. The time offset is then reduced by the -result and the result is scaled and becomes the value of the phase -adjustment. The phase adjustment is then corrected for the calculated -frequency offset and a fixed offset determined from the fixtick variable -in some kernel implementations. On rollover of the day, the leap-warning -indicator is checked and the apparent time adjusted +-1 s accordingly. -The microtime() routine insures that the reported time is always -monotonically increasing. +overflow. Upon overflow the maximum error time_maxerror is increased by +time_tolerance to reflect the maximum time offset due to oscillator +frequency error. Then, the increment time_adj to advance the kernel time +variable is calculated from the (scaled) time_offset and time_freq +variables updated at the last call to the hardclock() fragment. + +The phase adjustment is calculated as a (signed) fraction of the +time_offset remaining, where the fraction is added to time_adj, then +subtracted from time_offset. This technique provides a rapid convergence +when offsets are high, together with good resolution when offsets are +low. The frequency adjustment is the sum of the (scaled) time_freq +variable, an adjustment necessary when the tick interval does not evenly +divide one second fixtick and PPS frequency adjustment pps_freq (if +configured). + +The scheme of approximating exact multiply/divide operations with shifts +produces good results, except when an exact calculation is required, +such as when the PPS signal is being used to discipline the CPU clock +oscillator frequency as described below. As long as the actual +oscillator frequency is a power of two in Hz, no correction is required. +However, in the SunOS kernel the clock frequency is 100 Hz, which +results in an error factor of 0.78. In this case the code increases +time_adj by a factor of 1.25, which results in an overall error less +than three percent. + +On rollover of the day, the leap-second state machine described below +determines whether a second is to be inserted or deleted in the +timescale. The microtime() routine insures that the reported time is +always monotonically increasing. + +3.1.4. The hardpps() Fragment + +The hardpps() fragment is operative only if the PPS_SYNC option is +specified in the kernel configuration file. It is called from the serial +port driver or equivalent interface at the on-time transition of the PPS +signal. The code operates as a first-order, type-I, frequency-lock loop +(FLL) controlled by the difference between the frequency represented by +the pps_freq variable and the frequency of the hardware clock +oscillator. It also provides offsets to the hardupdate() fragment in +order to discipline the system clock time. + +In order to avoid calling the microtime() routine more than once for +each PPS transition, the interface requires the calling program to +capture the system time and hardware counter contents at the on-time +transition of the PPS signal and provide a pointer to the timestamp +(Unix timeval) and counter contents as arguments to the hardpps() call. +The hardware counter contents are determined by saving the microseconds +field of the system time, calling the microtime() routine, and +subtracting the saved value. If a microseconds overflow has occurred +during the process, the resulting microseconds value will be negative, +in which case the caller adds 1000000 to normalize the microseconds +field. + +In order to avoid large jitter when the PPS interrupt occurs during the +timer interrupt routine before the system clock is advanced, a glitch +detector is used. The detector latches when an offset exceeds a +threshold tick/2 and stays latched until either a subsequent offset is +less than the threshold or a specified interval MAXGLITCH (30 s) has +elapsed. As long as the detector remains latched, it outputs the offset +immediately preceding the latch, rather than the one received. + +A three-stage median filter is used to suppress jitter less than the +glitch threshold. The median sample drives the PLL, while the difference +between the other two samples represents the time dispersion. Time +dispersion samples are averaged and used as a jitter estimate. If this +estimate exceeds a threshold MAXTIME/2 (100 us), an error bit +STA_PPSJITTER is raised in the status word. + +The frequency of the hardware oscillator is determined from the +difference in hardware counter readings at the beginning and end of the +calibration interval divided by the duration of the interval. However, +the oscillator frequency tolerance, as much as 100 ppm, may cause the +difference to exceed the tick value, creating an ambiguity. In order to +avoid this ambiguity, the hardware counter value at the beginning of the +interval is increased by the current pps_freq value once each second, +but computed modulo the tick value. At the end of the interval, the +difference between this value and the value computed from the hardware +counter is the control signal for the FLL. + +Control signal samples which exceed the frequency tolerance MAXFREQ (100 +ppm) are discarded, as well as samples resulting from excessive interval +duration jitter. In these cases an error bit STA_PPSERROR is raised in +the status word. Surviving samples are then processed by a three-stage +median filter. The median sample drives the FLL, while the difference +between the other two samples represents the frequency dispersion. +Frequency dispersion samples are averaged and used as a stabiity +estimate. If this estimate is below a threshold MAXFREQ/4 (25 ppm), the +median sample is used to correct the oscillator frequency pps_freq with +a weight expressed as a shift PPS_AVG (2). + +Initially, an approximate value for the oscillator frequency is not +known, so the duration of the calibration interval must be kept small to +avoid overflowing the tick. The time difference at the end of the +calibration interval is measured. If greater than tick/4, the interval +is reduced by half. If less than this fraction for four successive +calibration intervals, the interval is doubled. This design +automatically adapts to nominal jitter in the PPS signal, as well as the +value of tick. The duration of the calibration interval is set by the +pps_shift variable as a shift in powers of two. The minimum value +PPS_SHIFT (2) is chosen so that with the highest CPU oscillator +frequency 1024 Hz and frequency tolerance 100 ppm the tick will not +overflow. The maximum value PPS_SHIFTMAX (8) is chosen such that the +maximum averaging time is about 1000 s as determined by measurements of +Allan variance [MIL93]. + +Should the PPS signal fail, the current frequency estimate pps_freq +continues to be used, so the nominal frequency remains correct subject +only to the instability of the undisciplined oscillator. The procedure +to save and restore the frequency estimate works as follows. When +setting the frequency from a file, the time_freq value is set as the +file value minus the pps_freq value; when retrieving the frequency, the +two values are added before saving in the file. This scheme provides a +seamless interface should the PPS signal fail or the kernel +configuration change. Note that the frequency discipline is active +whether or not the synchronization daemon is active. Since all Unix +systems take some time after reboot to build a running system, usually +by that time the discipline process has already settled down and the +initial transients due to frequency discipline have damped out. +3.1.4. External Clock Interface + +The external clock driver interface is implemented with two routines, +microtime(), which returns the current clock time, and clock_set(), +which furnishes the apparent system time derived from the kernel time +variable. The latter routine is called only when the clock is set using +the settimeofday() system call, but can be called from within the +driver, such as when the year rolls over, for example. + +In the stock SunOS kernel and modified Ultrix and OSF/1 kernels, the +microtime() routine returns the kernel time variable plus an +interpolation between timer interrupts based on the contents of a +hardware counter. In the case of an external clock, such as described +above, the system clock is read directly from the hardware clock +registers. Examples of external clock drivers are in the tprotime.c and +hightime.c routines included in the kernel.tar.Z distribution. + +The external clock routines return a status code which indicates whether +the clock is operating correctly and the nature of the problem, if not. +The return code is interpreted by the ntp_gettime() system call, which +transitions the status state machine to the TIME_ERR state if an error +code is returned. This is the only error checking implemented for the +external clock in the present version of the code. The simulator has been used to check the PLL operation over the design -envelope of +-128 ms in time error and +-100 ppm in frequency error. +envelope of +-512 ms in time error and +-100 ppm in frequency error. This confirms that no overflows occur and that the loop initially converges in about 15 minutes for timer interrupt rates from 50 Hz to -1024 Hz. The loop has a normal overshoot of about seven percent and a -final convergence time of several hours, depending on the initial time -and frequency error. +1024 Hz. The loop has a normal overshoot of a few percent and a final +convergence time of several hours, depending on the initial time and +frequency error. -4.2. Leap Seconds +3.2. Leap Seconds It does not seem generally useful in the user application interface to provide additional details private to the kernel and synchronization @@ -571,205 +760,615 @@ independently evaluate the quality of time and project into the future how long this time might be "valid." However, to do that properly would duplicate the functionality of the synchronization protocol and require knowledge of many mundane details of the platform architecture, such as -the subnet configuration, reachability status and related variables. -However, for the curious, the ntp_adjtime() system call can be used to -reveal some of these mysteries. +the subnet configuration, reachability status and related variables. For +the curious, the ntp_adjtime() system call can be used to reveal some of +these mysteries. However, the user application may need to know whether a leap second is scheduled, since this might affect interval calculations spanning the event. A leap-warning condition is determined by the synchronization protocol (if remotely synchronized), by the timecode receiver (if available), or by the operator (if awake). This condition is set by the -protocol daemon on the day the leap second is to occur (30 June or 31 -December, as announced) by specifying in a ntp_adjtime() system call a -clock status of either TIME_DEL, if a second is to be deleted, or -TIME_INS, if a second is to be inserted. Note that, on all occasions +synchronization daemon on the day the leap second is to occur (30 June +or 31 December, as announced) by specifying in a ntp_adjtime() system +call a status bit of either STA_DEL, if a second is to be deleted, or +STA_INS, if a second is to be inserted. Note that, on all occasions since the inception of the leap-second scheme, there has never been a -deletion occasion. If the value is TIME_DEL, the kernel adds one second -to the system time immediately following second 23:59:58 and resets the -clock status to TIME_OK. If the value is TIME_INS, the kernel subtracts -one second from the system time immediately following second 23:59:59 -and resets the clock status to TIME_OOP, in effect causing system time -to repeat second 59. Immediately following the repeated second, the -kernel resets the clock status to TIME_OK. +deletion, nor is there likely to be one in future. If the bit is +STA_DEL, the kernel adds one second to the system time immediately +following second 23:59:58 and resets the clock state to TIME_WAIT. If +the bit is STA_INS, the kernel subtracts one second from the system time +immediately following second 23:59:59 and resets the clock stateto +TIME_OOP, in effect causing system time to repeat second 59. Immediately +following the repeated second, the kernel resets the clock status to +TIME_WAIT. + +Following the leap operations, the clock remains in the TIME_WAIT state +until both the STA_DEL and STA_INS status bits are reset. This provides +both an unambiguous indication that a leap recently occured, as well as +time for the daemon or operator to clear the warning condition. Depending upon the system call implementation, the reported time during a leap second may repeat (with the TIME_OOP return code set to advertise that fact) or be monotonically adjusted until system time "catches up" to reported time. With the latter scheme the reported time will be correct before and shortly after the leap second (depending on the -number of microtime() calls during the leap second itself), but freeze -or slowly advance during the leap second itself. However, Most programs +number of microtime() calls during the leap second), but freeze or +slowly advance during the leap second itself. However, Most programs will probably use the ctime() library routine to convert from timeval (seconds, microseconds) format to tm format (seconds, minutes,...). If this routine is modified to use the ntp_gettime() system call and inspect the return code, it could simply report the leap second as second 60. -To determine local midnight without fuss, the kernel simply finds the -residue of the time.tv_sec value mod 86,400, but this requires a messy -divide. Probably a better way to do this is to initialize an auxiliary -counter in the settimeofday() routine using an ugly divide and increment -the counter at the same time the time.tv_sec is incremented in the timer -interrupt routine. For future embellishment. +3.3. Clock Status State Machine -4.2. Kernel Variables +The various options possible with the system clock model described in +this memorandum require a careful examination of the state transitions, +status indications and recovery procedures should a crucial signal or +interface fail. In this section is presented a prototype state machine +designed to support leap second insertion and deletion, as well as +reveal various kinds of errors in the synchronization process. The +states of this machine are decoded as follows: -The following kernel variables are defined by the new code: + TIME_OK If a PPS signal or external clock is present, it is + working properly and the system clock is derived + from it. If not, the synchronization daemon is + working properly and the system clock is + synchronized to a radio clock or one or more peers. -long time_offset = 0; /* time adjustment (us) */ + TIME_INS An insertion of one second in the system clock has + been declared following the last second of the + current day, but has not yet been executed. - This variable is used by the PLL to adjust the system time in small - increments. It is scaled by (1 << SHIFT_UPDATE) in binary - microseconds. The maximum value that can be represented is about +- - 512 ms and the minimum value or precision is one microsecond. + TIME_DEL A deletion of the last second of the current day has + been declared, but not yet executed. -long time_constant = 0; /* pll time constant */ + TIME_OOP An insertion of one second in the system clock has + been declared following the last second of the + current day. The second is in progress, but not yet + completed. Library conversion routines should + interpret this second as 23:59:60. - This variable determines the bandwidth or "stiffness" of the PLL. - It is used as a shift, with the effective value in positive powers - of two. The default value (0) corresponds to a PLL time constant of - about 4 minutes. + TIME_WAIT The scheduled leap event has occurred, but the + STA_DEL and STA_INS status bits have not yet been + cleared. -long time_tolerance = MAXFREQ; /* frequency tolerance (ppm) */ + TIME_ERROR Either (a) the synchronization daemon has declared + the protocol is not working properly, (b) all + sources of outside synchronization have been lost or + (c) a PPS signal or external clock is present, but + not working properly. - This variable represents the maximum frequency error or tolerance - of the particular platform and is a property of the architecture. - It is expressed as a positive number greater than zero in parts- - per-million (ppm). The default MAXFREQ (100) is appropriate for - conventional workstations. +In all states the system clock is derived from either a PPS signal or +external clock, if present, or the kernel time variable, if not. If a +PPS error condition is recognized, the PPS signal is disabled and +ntp_adjtime() updates are used instead. If an external clock error +condition is recognized, the external clock is disabled and the kernel +time variable is used instead. -long time_precision = 1000000 / HZ; /* clock precision (us) */ +The state machine makes a transition once each second at an instant +where the microseconds field of the kernel time variable overflows and +one second is added to the seconds field. However, this condition is +checked when the timer overflows, which may not coincide with the actual +seconds increment. This may lead to some interesting anomalies, such as +a status indication of a leap second in progress (TIME_OOP) when the +leap second has already expired. This ambiguity is unavoidable, unless +the timer interrupt is made synchronous with the system clock. - This variable represents the maximum error in reading the system - clock. It is expressed as a positive number greater than zero in - microseconds and is usually based on the number of microseconds - between timer interrupts, 3906 usec for the Ultrix kernel, 976 usec - for the OSF/1 kernel. However, in cases where the time can be - interpolated between timer interrupts with microsecond resolution, - such as in the unmodified SunOS kernel and modified Ultrix and - OSF/1 kernels, the precision is specified as 1 usec. This variable - is computed by the kernel for use by the time-synchronization - daemon, but is otherwise not used by the kernel. +The following state transitions are executed automatically by the kernel +at rollover of the microseconds field: -long time_maxerror; /* maximum error */ + any state -> TIME_ERROR This transition occurs when an error + condition is recognized and continues as long + as the condition persists. The error indication + overrides the normal state indication, but does + not affect the actual clock state. Therefore, + when the condition is cleared, the normal state + indication resumes. - This variable establishes the maximum error of the indicated time - relative to the primary reference source, in microseconds. For NTP, - the value is determined as the synchronization distance, which is - equal to the root dispersion plus one-half the root delay. It is - increased by a small amount (time_tolerance) each second to reflect - the clock frequency tolerance. This variable is computed by the - time-synchronization daemon and the kernel, but is otherwise not - used by the kernel. + TIME_OK->TIME_DEL This transition occurs if the STA_DEL bit is + set in the status word. -long time_esterror; /* estimated error */ + TIME_OK->TIME_INS This transition occurs if the STA_INS bit is + set in the status word. - This variable establishes the expected error of the indicated time - relative to the primary reference source, in microseconds. For NTP, + TIME_INS->TIME_OOP This transition occurs immediately following + second 86,400 of the current day when an + insert-second event has been declared. + + TIME_OOP->TIME_WAIT This transition occurs immediately following + second 86,401 of the current day; that is, one + second after entry to the TIME_OOP state. + + TIME_DEL->TIME_WAIT This transition occurs immediately following + second 86,399 of the current day when a delete- + second event has been declared. + + TIME_WAIT->TIME_OK This transition occurs when the STA_DEL and + STA_INS bits are cleared by an ntp_adjtime() + call. + +The following table summarizes the actions just before, during and just +after a leap-second event. Each line in the table shows the UTC and NTP +times at the beginning of the second. The left column shows the behavior +when no leap event is to occur. In the middle column the state machine +is in TIME_INS at the end of UTC second 23:59:59 and the NTP time has +just reached 400. The NTP time is set back one second to 399 and the +machine enters TIME_OOP. At the end of the repeated second the machine +enters TIME_OK and the UTC and NTP times are again in correspondence. In +the right column the state machine is in TIME_DEL at the end of UTC +second 23:59:58 and the NTP time has just reached 399. The NTP time is +incremented, the machine enters TIME_OK and both UTC and NTP times are +again in correspondence. + + No Leap Leap Insert Leap Delete + UTC NTP UTC NTP UTC NTP + --------------------------------------------- + 23:59:58|398 23:59:58|398 23:59:58|398 + | | | + 23:59:59|399 23:59:59|399 00:00:00|400 + | | | + 00:00:00|400 23:59:60|399 00:00:01|401 + | | | + 00:00:01|401 00:00:00|400 00:00:02|402 + | | | + 00:00:02|402 00:00:01|401 00:00:03|403 + | | | +To determine local midnight without fuss, the kernel code simply finds +the residue of the time.tv_sec (or time.tv_sec + 1) value mod 86,400, +but this requires a messy divide. Probably a better way to do this is to +initialize an auxiliary counter in the settimeofday() routine using an +ugly divide and increment the counter at the same time the time.tv_sec +is incremented in the timer interrupt routine. For future embellishment. + +4. Programming Model and Interfaces + +This section describes the programming model for the synchronization +daemon and user application programs. The ideas are based on suggestions +from Jeff Mogul and Philip Gladstone and a similar interface designed by +the latter. It is important to point out that the functionality of the +original Unix adjtime() system call is preserved, so that the modified +kernel will work as the unmodified one, should the new features not be +in use. In this case the ntp_adjtime() system call can still be used to +read and write kernel variables that might be used by a synchronization +daemon other than NTP, for example. + +The kernel routines use the clock state variable time_state, which +records whether the clock is synchronized, waiting for a leap second, +etc. The value of this variable is returned as the result code by both +the ntp_gettime() and ntp_adjtime() system calls. It is set implicitly +by the STA_DEL and STA_INS status bits, as described previously. Values +presently defined in the timex.h header file are as follows: + + TIME_OK 0 no leap second warning + TIME_INS 1 insert leap second warning + TIME_DEL 2 delete leap second warning + TIME_OOP 3 leap second in progress + TIME_WAIT 4 leap second has occured + TIME_ERROR 5 clock not synchronized + +In case of a negative result code, the kernel has intercepted an invalid +address or (in case of the ntp_adjtime() system call), a superuser +violation. + +4.1. The ntp_gettime() System Call + +The syntax and semantics of the ntp_gettime() call are given in the +following fragment of the timex.h header file. This file is identical, +except for the SHIFT_HZ define, in the SunOS, Ultrix and OSF/1 kernel +distributions. (The SHIFT_HZ define represents the logarithm to the base +2 of the clock oscillator frequency specific to each system type.) Note +that the timex.h file calls the syscall.h system header file, which must +be modified to define the SYS_ntp_gettime system call specific to each +system type. The kernel distributions include directions on how to do +this. + + /* + * This header file defines the Network Time Protocol (NTP) + * interfaces for user and daemon application programs. These are + * implemented using private system calls and data structures and + * require specific kernel support. + * + * NAME + * ntp_gettime - NTP user application interface + * + * SYNOPSIS + * #include + * + * int system call(SYS_ntp_gettime, tptr) + * + * int SYS_ntp_gettime defined in syscall.h header file + * struct ntptimeval *tptr pointer to ntptimeval structure + * + * NTP user interface - used to read kernel clock values + * Note: maximum error = NTP synch distance = dispersion + delay / + * 2 + * estimated error = NTP dispersion. + */ + struct ntptimeval { + struct timeval time; /* current time (ro) */ + long maxerror; /* maximum error (us) (ro) */ + long esterror; /* estimated error (us) (ro) */ + }; + +The ntp_gettime() system call returns three read-only (ro) values in the +ntptimeval structure: the current time in unix timeval format plus the +maximum and estimated errors in microseconds. While the 32-bit long data +type limits the error quantities to something more than an hour, in +practice this is not significant, since the protocol itself will declare +an unsynchronized condition well below that limit. In the NTP Version 3 +specification, if the protocol computes either of these values in excess +of 16 seconds, they are clamped to that value and the system clock +declared unsynchronized. + +Following is a detailed description of the ntptimeval structure members. + +struct timeval time (ro) + + This member is the current system time expressed as a Unix timeval + structure. The timeval structure consists of two 32-bit words; the + first is the number of seconds past 1 January 1970 assuming no + intervening leap-second insertions or deletions, while the second + is the number of microseconds within the second. + +long maxerror (ro) + + This member is the value of the time_maxerror kernel variable, + which represents the maximum error of the indicated time relative + to the primary synchronization source, in microseconds. For NTP, + the value is initialized by a ntp_adjtime() call to the + synchronization distance, which is equal to the root dispersion + plus one-half the root delay. It is increased by a small amount + (time_tolerance) each second to reflect the maximum clock frequency + error. This variable is provided bu a ntp-adjtime() system call and + modified by the kernel, but is otherwise not used by the kernel. + +long esterror (ro) + + This member is the value of the time_esterror kernel variable, + which represents the expected error of the indicated time relative + to the primary synchronization source, in microseconds. For NTP, the value is determined as the root dispersion, which represents the best estimate of the actual error of the system clock based on its past behavior, together with observations of multiple clocks - within the peer group. This variable is computed by the time- - synchronization daemon and returned in system calls, but is - otherwise not used by the kernel. + within the peer group. This variable is provided bu a ntp-adjtime() + system call, but is otherwise not used by the kernel. -long time_phase = 0; /* phase offset (scaled us) */ -long time_freq = 0; /* frequency offset (scaled ppm) */ -time_adj = 0; /* tick adjust (scaled 1 / HZ) */ +4.2. The ntp_adjtime() System Call - These variables control the phase increment and the frequency - increment of the system clock at each tick. The time_phase variable - is scaled by (1 << SHIFT_SCALE) (24) in microseconds, giving a - maximum adjustment of about +-128 us/tick and a resolution of about - 60 femtoseconds/tick. The time_freq variable is scaled by (1 << - SHIFT_KF) in parts-per-million (ppm), giving it a maximum value of - over +-2000 ppm and a minimum value (frequency resolution) of about - 1e-5 ppm. The time_adj variable is the actual phase increment in - scaled microseconds to add to time_phase once each tick. It is - computed from time_phase and time_freq once per second. +The syntax and semantics of the ntp_adjtime() call are given in the +following fragment of the timex.h header file. Note that, as in the +ntp_gettime() system call, the syscall.h system header file must be +modified to define the SYS_ntp_adjtime system call specific to each +system type. In the fragment, rw = read/write, ro = read-only, wo = +write-only. -long time_reftime = 0; /* time at last adjustment (s) */ + /* + * NAME + * ntp_adjtime - NTP daemon application interface + * + * SYNOPSIS + * #include + * + * int system call(SYS_ntp_adjtime, mode, tptr) + * + * int SYS_ntp_adjtime defined in syscall.h header file + * struct timex *tptr pointer to timex structure + * + * NTP daemon interface - used to discipline kernel clock + * oscillator + */ + struct timex { + unsigned int mode; /* mode selector (wo) */ + long offset; /* time offset (us) (rw) */ + long frequency; /* frequency offset (scaled ppm) (rw) + */ + long maxerror; /* maximum error (us) (rw) */ + long esterror; /* estimated error (us) (rw) */ + int status; /* clock status bits (rw) */ + long constant; /* pll time constant (rw) */ + long precision; /* clock precision (us) (ro) */ + long tolerance; /* clock frequency tolerance (scaled + * ppm) (ro) */ + /* + * The following read-only structure members are implemented + * only if the PPS signal discipline is configured in the + * kernel. + */ + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) + */ + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + }; - This variable is the second's portion of the system time on the - last call to adjtime(). It is used to adjust the time_freq variable - as the time since the last update increases. +The ntp_adjtime() system call is used to read and write certain time- +related kernel variables summarized below. Writing these variables can +only be done in superuser mode. To write a variable, the mode structure +member is set with one or more bits, one of which is assigned each of +the following variables in turn. The current values for all variables +are returned in any case; therefore, a mode argument of zero means to +return these values without changing anything. -int fixtick = 1000000 % HZ; /* amortization factor */ +Following is a description of the timex structure members. - In some systems such as the Ultrix and OSF/1 kernels, the local - clock runs at some frequency that does not divide the number of - microseconds in the second. In order that the clock runs at a - precise rate, it is necessary to introduce an amortization factor - into the local timescale, in effect a leap-multimicrosecond. This - is not a new kernel variable, but a new use of an existing kernel - variable. +mode (wo) -4.3. Architecture Constants + This is a bit-coded variable selecting one or more structure + members, with one bit assigned each member. If a bit is set, the + value of the associated member variable is copied to the + corresponding kernel variable; if not, the member is ignored. The + bits are assigned as given in the following, with the variable name + indicated in parens. Note that the precision, tolerance and PPS + variables are determined by the kernel and cannot be changed by + ntp_adjtime(). -Following is a list of the important architecture constants that -establish the response and stability of the PLL and provide maximum -bounds on behavior in order to satisfy correctness assertions made in -the protocol specification. + MOD_OFFSET 0x0001 time offset (offset) + MOD_FREQUENCY 0x0002 frequency offset (frequency) + MOD_MAXERROR 0x0004 maximum time error (maxerror) + MOD_ESTERROR 0x0008 estimated time error (esterror) + MOD_STATUS 0x0010 clock status (status) + MOD_TIMECONST 0x0020 pll time constant (constant) + MOD_CLKB 0x4000 set clock B + MOD_CLKA 0x8000 set clock A -#define HZ 256 /* timer interrupt frequency (Hz) */ -#define SHIFT_HZ 8 /* log2(HZ) */ + Note that the MOD_CLK0 and MOD_CLK1 bits are intended for those + systems where more than one hardware clock is available for backup, + such as in Tandem Non-Stop computers. Presumably, in such cases + each clock would have its own oscillator and require a separate PLL + for each. Refinements to this model are for further study. The + interpretation of these bits is as follows: - The HZ define (a variable in some kernels) establishes the timer - interrupt frequency, 100 Hz for the SunOS kernel, 256 Hz for the - Ultrix kernel and 1024 Hz for the OSF/1 kernel. The SHIFT_HZ define - expresses the same value as the nearest power of two in order to - avoid hardware multiply operations. These are the only parameters - that need to be changed for different kernel timer interrupt - frequencies. +offset (rw) -#define SHIFT_KG 6 /* shift for phase increment */ -#define SHIFT_KF 16 /* shift for frequency increment */ -#define MAXTC 6 /* maximum time constant (shift) */ + If selected, this member specifies the time adjustment, in + microseconds. The absolute value must be less than MAXPHASE + (128000) microseconds defined in the timex.h header file. On + return, this member contains the residual offset remaining between + a previously specified offset and the current system time, in + microseconds. - These defines establish the response and stability characteristics - of the PLL model. The SHIFT_KG and SHIFT_KF defines establish the - damping of the PLL and are chosen by analysis for a slightly - underdamped convergence characteristic. The MAXTC define - establishes the maximum time constant of the PLL. +frequency (rw) -#define SHIFT_SCALE (SHIFT_KF + SHIFT_HZ) /* shift for scale factor */ -#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* shift for offset scale - * factor */ -#define SHIFT_USEC 16 /* shift for 1 us in external units */ -#define FINEUSEC (1 << SHIFT_SCALE) /* 1 us in scaled units */ + If selected, this member replaces the value of the time_frequency + kernel variable. The value is in ppm, with the integer part in the + high order 16 bits and fraction in the low order 16 bits. The + absolute value must be in the range less than MAXFREQ (100) ppm + defined in the timex.h header file. - The SHIFT_SCALE define establishes the decimal point on the - time_phase variable which serves as a an extension to the low-order - bits of the system clock variable. The SHIFT_UPDATE define - establishes the decimal point of the phase portion of the - ntp_adjtime() update. The SHIFT_USEC define represents 1 us in - external units (shift), while the FINEUSEC define represents 1 us - in internal units. + The time_freq variable represents the frequency offset of the CPU + clock oscillator. It is recalculated as each update to the system + clock is determined by the offset member of the timex structure. It + is usually set from a value stored in a file when the + synchronization daemon is first started. The current value is + usually retrieved via this member and written to the file about + once per hour. -#define MAXPHASE 128000 /* max phase error (usec) */ -#define MAXFREQ 100 /* max frequency error (ppm) */ -#define MINSEC 16 /* min interval between updates (s) */ -#define MAXSEC 1200 /* max interval between updates (s) */ +maxerror (rw) - These defines establish the performance envelope of the PLL, one to - bound the maximum phase error, another to bound the maximum - frequency error and two others to bound the minimum and maximum - time between updates. The intent of these bounds is to force the - PLL to operate within predefined limits in order to conform to the - correctness models assumed by time-synchronization protocols like - NTP and DTSS. An excursion which exceeds these bounds is clamped to - the bound and operation proceeds accordingly. In practice, this can - occur only if something has failed or is operating out of - tolerance, but otherwise the PLL continues to operate in a stable - mode. Note that the MAXPHASE define conforms to the maximum offset - allowed in NTP before the system time is reset (by settimeofday(), - rather than incrementally adjusted (by ntp_adjtime(). + If selected, this member replaces the value of the time_maxerror + kernel variable, in microseconds. This is the same variable as in + the ntp_getime() system call. + +esterror (rw) + + If selected, this member replaces the value of the time_esterror + kernel variable, in microseconds. This is the same variable as in + the ntp_getime() system call. + +int status (rw) + + If selected, this member replaces the value of the time_status + kernel variable. This variable controls the state machine used to + insert or delete leap seconds and shows the status of the + timekeeping system, PPS signal and external oscillator, if + configured. + + STA_PLL 0x0001 enable PLL updates (r/w) + STA_PPSFREQ 0x0002 enable PPS freq discipline (r/w) + STA_PPSTIME 0x0004 enable PPS time discipline (r/w) + STA_INS 0x0010 insert leap (r/w) + STA_DEL 0x0020 delete leap (r/w) + STA_UNSYNC 0x0040 clock unsynchronized (r/w) + STA_PPSSIGNAL 0x0100 PPS signal present (r) + STA_PPSJITTER 0x0200 PPS signal jitter exceeded (r) + STA_PPSWANDER 0x0400 PPS signal wander exceeded (r) + STA_PPSERROR 0x0800 PPS signal calibration error (r) + STA_CLOCKERR 0x1000 clock hardware fault (r) + + The interpretation of these bits is as follows: + + STA_PLL set/cleared by the caller to enable PLL updates + + STA_PPSFREQ set/cleared by the caller to enable PPS frequency + discipline + + STA_PPSTIME set/cleared by the caller to enable PPS time + discipline + + STA_INS set by the caller to insert a leap second at the end + of the current day; cleared by the caller after the + event + + STA_DEL set by the caller to delete a leap second at the end + of the current day; cleared by the caller after the + event + + STA_UNSYNC set/cleared by the caller to indicate clock + unsynchronized (e.g., when no peers are reachable) + + STA_PPSSIGNAL set/cleared by the hardpps() fragment to indicate + PPS signal present + + STA_PPSJITTER set/cleared by the hardpps() fragment to indicates + PPS signal jitter exceeded + + STA_PPSWANDER set/cleared by the hardpps() fragment to indicates + PPS signal wander exceeded + + STA_PPSERROR set/cleared by the hardpps() fragment to indicates + PPS signal calibration error + + STA_CLOCKERR set/cleared by the external hardware clock driver to + indicate hardware fault + + An error condition is raised when (a) either STA_UNSYNC or + STA_CLOCKERR is set (loss of synchronization), (b) STA_PPSFREQ or + STA_PPSTIME is set and STA_PPSSIGNAL is clear (loss of PPS signal), + (c) STA_PPSTIME and STA_PPSJITTER are both set (jitter exceeded), + (d) STA_PPSFREQ is set and either STA_PPSWANDER or STA_PPSERROR is + set (wander exceeded). An error condition results in a system call + return code of TIME_ERROR. + +constant (rw) + + If selected, this member replaces the value of the time_constant + kernel variable. The value must be between zero and MAXTC (6) + defined in the timex.h header file. + + The time_constant variable determines the bandwidth or "stiffness" + of the PLL. The value is used as a shift between zero and MAXTC + (6), with the effective PLL time constant equal to a multiple of (1 + << time_constant), in seconds. For room-temperature quartz + oscillators, the recommended default value is 2, which corresponds + to a PLL time constant of about 900 s and a maximum update interval + of about 64 s. The maximum update interval scales directly with the + time constant, so that at the maximum time constant of 6, the + update interval can be as large as 1024 s. + + Values of time_constant between zero and 2 can be used if quick + convergence is necessary; values between 2 and 6 can be used to + reduce network load, but at a modest cost in accuracy. Values above + 6 are appropriate only if an precision external oscillator is + present. + +precision (ro) + + This is the current value of the time_precision kernel variable in + microseconds. + + The time_precision variable represents the maximum error in reading + the system clock, in microseconds. It is usually based on the + number of microseconds between timer interrupts (tick), 10000 us + for the SunOS kernel, 3906 us for the Ultrix kernel, 976 us for the + OSF/1 kernel. However, in cases where the time can be interpolated + between timer interrupts with microsecond resolution, such as in + the stock SunOS kernel and modified Ultrix and OSF/1 kernels, the + precision is specified as 1 us. In cases where a PPS signal or + external oscillator is available, the precision can depend on the + operating condition of the signal or oscillator. This variable is + determined by the kernel for use by the synchronization daemon, but + is otherwise not used by the kernel. + +tolerance (ro) + + This is the current value of the time_tolerance kernel variable. + The value is in ppm, with the integer part in the high order 16 + bits and fraction in the low order 16 bits. + + The time_tolerance variable represents the maximum frequency error + in ppm of the particular CPU clock oscillator and is a property of + the hardware; however, in principle it could change as result of + the presence of external discipline signals, for instance. + + The recommended value for time_tolerance MAXFREQ (200) ppm is + appropriate for room-temperature quartz oscillators used in typical + workstations. However, it can change due to the operating condition + of the PPS signal and/or external oscillator. With either the PPS + signal or external oscillator, the recommended value for MAXFREQ is + 100 ppm. + +The following members are defined only if the PPS_SYNC option is +specified in the kernel configuration file. These members are useful +primarily as a monitoring and evalutation tool. These variables can be +written only by the kernel. + +ppsfreq (ro) + + This is the current value of the pps_freq kernel variable, which is + the CPU clock oscillator frequency offset relative to the PPS + discipline signal. The value is in ppm, with the integer part in + the high order 16 bits and fraction in the low order 16 bits. + +jitter (ro) + + This is the current value of the pps_jitter kernel variable, which + is the average PPS time dispersion measured by the time-offset + median filter, in microseconds. + +shift (ro) + + This is the current value of the pps_shift kernel variable, which + determines the duration of the calibration interval as the value of + 1 << pps_shift, in seconds. +stabil (ro) + + This is the current value of the pps_stabil kernel variable, which + is the average PPS frequency dispersion measured by the frequency- + offset median filter. The value is in ppm, with the integer part in + the high order 16 bits and fraction in the low order 16 bits. + +jitcnt (ro) + + This is the current value of the pps_jitcnt kernel variable, counts + the number of PPS signals where the average jitter exceeds the + threshold MAXTIME (200 us). + +calcnt (ro) + + This is the current value of the pps_calcnt kernel variable, which + counts the number of frequency calibration intervals. The duration + of these intervals can range from 4 to 256 seconds, as determined + by the pps_shift kernel variable. + +errcnt (ro) + + This is the current value of the pps_errcnt kernel variable, which + counts the number of frequency calibration cycles where (a) the + apparent frequency offset is greater than MAXFREQ (100 ppm) or (b) + the interval jitter exceeds tick * 2. + +stbcnt (ro) + + This is the current value of the pps_discnt kernel variable, which + counts the number of calibration intervals where the average + stability exceeds the threshold MAXFREQ / 4 (25 ppm). + +7. References + +[MIL91] Mills, D.L. Internet time synchronization: the Network Time +Protocol, IEEE Trans. Communications COM-39, 10 (October 1991), +1482-1493. Also in: Yang, Z., and T.A. Marsland (Eds.). Global +States and Time in Distributed Systems, IEEE Press, Los Alamitos, +CA, 91-102. + +[MIL92a] Mills, D.L. Network Time Protocol (Version 3) specification, +implementation and analysis, RFC 1305, University of Delaware, March +1992, 113 pp. + +[MIL92b] Mills, D.L. Modelling and analysis of computer network clocks, +Electrical Engineering Department Report 92-5-2, University of Delaware, +May 1992, 29 pp. + +[MIL92c] Mills, D.L. Simple Network Time Protocol (SNTP), RFC 1361, +University of Delaware, August 1992, 10 pp. + +[MIL93] Mills, D.L. Precision synchronizatin of computer network clocks, +Electrical Engineering Department Report 93-11-1, University of +Delaware, November 1993, 66 pp. + +[LEV89] Levine, J., M. Weiss, D. Davis, D. Allan, and D. Sullivan. The +NIST automated computer time service. J. Research National Institute of +Standards and Technology 94, 5 (September-October 1989), 311-321. David L. Mills Electrical Engineering Department University of Delaware Newark, DE 19716 302 831 8247 fax 302 831 4316 - -1 April 1992 +3 April 1994 diff --git a/contrib/xntpd/doc/notes.txt b/contrib/xntpd/doc/notes.txt index 5ea2b3318bb3..1dd59f25b3ac 100644 --- a/contrib/xntpd/doc/notes.txt +++ b/contrib/xntpd/doc/notes.txt @@ -785,7 +785,7 @@ configuration functionality (though the only thing you can currently do with mode-6 messages is set the leap-second warning bits) and the ntpq program provides generic support for the latter. The leap bits that can be set in the leap_warning variable (up to one month ahead) and in the -leap_indication variable have a slighly different encoding than the +leap_indication variable have a slightly different encoding than the usual interpretation: Value Action diff --git a/contrib/xntpd/gadget/.keep_me b/contrib/xntpd/gadget/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/hints/.keep_me b/contrib/xntpd/hints/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/include/l_stdlib.h b/contrib/xntpd/include/l_stdlib.h index 89a8092853b5..e0b7c474095c 100644 --- a/contrib/xntpd/include/l_stdlib.h +++ b/contrib/xntpd/include/l_stdlib.h @@ -70,11 +70,11 @@ extern int getppid P((void)); extern int close P((int)); extern int ioctl P((int, int, char *)); -extern int read P((int, char *, unsigned)); +extern int read P((int, void *, unsigned)); extern int rename P((char *, char *)); -extern int write P((int, char *, int)); -extern int unlink P((char *)); -extern int link P((char *, char *)); +extern int write P((int, const void *, unsigned)); +extern int unlink P((const char *)); +extern int link P((const char *, const char *)); #ifdef FILE extern int fclose P((FILE *)); diff --git a/contrib/xntpd/include/ntp.h b/contrib/xntpd/include/ntp.h index 310353f1cda2..01bfa16a7ad8 100644 --- a/contrib/xntpd/include/ntp.h +++ b/contrib/xntpd/include/ntp.h @@ -173,6 +173,7 @@ struct interface { #define INT_BROADCAST 1 /* can broadcast out this interface */ #define INT_BCASTOPEN 2 /* broadcast socket is open */ #define INT_LOOPBACK 4 /* the loopback interface */ +#define INT_MULTICAST 8 /* multicasting enabled */ /* * Define flasher bits (tests 1 through 8 in packet procedure) @@ -222,7 +223,7 @@ struct peer { U_LONG keyid; /* encription key ID */ U_LONG pkeyid; /* keyid used to encrypt last message */ u_short associd; /* association ID, a unique integer */ - u_char unused; + u_char ttl; /* time to live (multicast) */ /* **Start of clear-to-zero area.*** */ /* Everything that is cleared to zero goes below here */ u_char valid; /* valid counter */ @@ -248,12 +249,6 @@ struct peer { s_fp soffset; /* fp version of above */ s_fp synch; /* synch distance from above */ u_fp selectdisp; /* select dispersion */ - - /* - * Stuff related to the experimental broadcast delay - * determination code. The registers will probably go away - * later. - */ U_LONG estbdelay; /* broadcast delay, as a ts fraction */ /* @@ -346,7 +341,7 @@ struct peer { */ #define REFCLK_NONE 0 /* unknown or missing */ #define REFCLK_LOCALCLOCK 1 /* external (e.g., ACTS) */ -#define REFCLK_WWV_HEATH 2 /* Heath GC-1000 WWV/H */ +#define REFCLK_GPS_TRAK 2 /* TRAK 8810 GPS Receiver */ #define REFCLK_WWV_PST 3 /* PST/Traconex 1020 WWV/H */ #define REFCLK_WWVB_SPECTRACOM 4 /* Spectracom 8170/Netclock WWVB */ #define REFCLK_GOES_TRUETIME 5 /* TrueTime 468-DC GOES */ @@ -579,8 +574,8 @@ struct recvbuf { #define PROTO_AUTHENTICATE 3 #define PROTO_BROADDELAY 4 #define PROTO_AUTHDELAY 5 -#define PROTO_MAXSKEW 6 -#define PROTO_SELECT 7 +#define PROTO_MULTICAST_ADD 6 +#define PROTO_MULTICAST_DEL 7 /* * Configuration items for the loop filter @@ -603,7 +598,7 @@ struct recvbuf { */ #define DEFPRECISION (-5) /* conservatively low */ #define DEFBROADDELAY (0x020c49ba) /* 8 ms. This is round trip delay */ - +#define INADDR_NTP 0xe0000101 /* NTP multicast address 224.0.1.1 */ /* * Structure used optionally for monitoring when this is turned on. */ @@ -612,6 +607,9 @@ struct mon_data { struct mon_data *hash_prev; /* previous structure in hash list */ struct mon_data *mru_next; /* next structure in MRU list */ struct mon_data *mru_prev; /* previous structure in MRU list */ + struct mon_data *fifo_next; /* next structure in FIFO list */ + struct mon_data *fifo_prev; /* previous structure in FIFO list */ + U_LONG lastdrop; /* last time dropped due to RES_LIMIT*/ U_LONG lasttime; /* last time data updated */ U_LONG firsttime; /* time structure initialized */ U_LONG count; /* count we have seen */ @@ -621,7 +619,12 @@ struct mon_data { u_char version; /* version of incoming packet */ }; - +/* + * Values used with mon_enabled to indicate reason for enabling monitoring + */ +#define MON_OFF 0x00 /* no monitoring */ +#define MON_ON 0x01 /* monitoring explicitly enabled */ +#define MON_RES 0x02 /* implicit monitoring for RES_LIMITED */ /* * Structure used for restrictlist entries */ @@ -645,10 +648,11 @@ struct restrictlist { #define RES_NOPEER 0x20 /* don't allocate memory resources */ #define RES_NOTRAP 0x40 /* don't allow him to set traps */ #define RES_LPTRAP 0x80 /* traps set by him are low priority */ +#define RES_LIMITED 0x100 /* limit per net number of clients */ #define RES_ALLFLAGS \ (RES_IGNORE|RES_DONTSERVE|RES_DONTTRUST|RES_NOQUERY\ - |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP) + |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED) /* * Match flags diff --git a/contrib/xntpd/include/ntp_control.h b/contrib/xntpd/include/ntp_control.h index 74f75f17f51a..1e193835660d 100644 --- a/contrib/xntpd/include/ntp_control.h +++ b/contrib/xntpd/include/ntp_control.h @@ -68,6 +68,7 @@ struct ntp_control { #define CTL_SST_TS_UDPTIME 7 /* time source UDP/TIME */ #define CTL_SST_TS_WRSTWTCH 8 /* time source is wristwatch */ #define CTL_SST_TS_TELEPHONE 9 /* time source is telephone modem */ +#define CTL_SST_TS_PPS 0x20 /* time source is PPS signal */ #define CTL_SYS_MAXEVENTS 15 diff --git a/contrib/xntpd/include/ntp_if.h b/contrib/xntpd/include/ntp_if.h index 1a76ca02da4b..45a70c51bcd5 100644 --- a/contrib/xntpd/include/ntp_if.h +++ b/contrib/xntpd/include/ntp_if.h @@ -16,6 +16,10 @@ #include #endif +#if defined(SYS_UNIXWARE1) +#include +#endif + #if defined(SYS_PTX) || defined(SYS_SINIXM) #include #include diff --git a/contrib/xntpd/include/ntp_in.h b/contrib/xntpd/include/ntp_in.h new file mode 100755 index 000000000000..80aa45151fc6 --- /dev/null +++ b/contrib/xntpd/include/ntp_in.h @@ -0,0 +1,259 @@ +/* @(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at 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'' without express or implied warranty. + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +#ifndef _netinet_in_h +#define _netinet_in_h +#define _NETINET_IN_H_ +#define _SYS_IN_INCLUDED +#define __IN_HEADER + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group control protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_ST 5 /* st */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_HELLO 63 /* "hello" routing protocol */ +#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */ +#define IPPROTO_OSPF 89 /* Open SPF IGP */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Internet address + * This definition contains obsolete fields for compatibility + * with SunOS 3.x and 4.2bsd. The presence of subnets renders + * divisions into fixed fields misleading at best. New code + * should use only the s_addr field. + */ +struct in_addr { + union { + struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { u_short s_w1,s_w2; } S_un_w; + u_long S_addr; + } S_un; +#define s_addr S_un.S_addr /* should be used for all code */ +#define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */ +#define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */ +#define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */ +#define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */ +#define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */ +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ + +#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define IP_OPTIONS 1 /* set/get IP per-packet options */ +#define IP_MULTICAST_IF 2 /* set/get IP multicast interface */ +#define IP_MULTICAST_TTL 3 /* set/get IP multicast timetolive */ +#define IP_MULTICAST_LOOP 4 /* set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 5 /* add an IP group membership */ +#define IP_DROP_MEMBERSHIP 6 /* drop an IP group membership */ + +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +#if !defined(vax) && !defined(ntohl) && !defined(i386) +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) +#endif + +#if !defined(ntohl) && (defined(vax) || defined(i386)) +u_short ntohs(), htons(); +u_long ntohl(), htonl(); +#endif + +#ifdef KERNEL +extern struct domain inetdomain; +extern struct protosw inetsw[]; +struct in_addr in_makeaddr(); +u_long in_netof(), in_lnaof(); +#endif + +#ifndef BYTE_ORDER +/* + * Definitions for byte order, + * according to byte significance from low address to high. + */ +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ + +#if defined(vax) || defined(i386) +#define BYTE_ORDER LITTLE_ENDIAN +#else +#define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ +#endif +#endif BYTE_ORDER + +/* + * Macros for number representation conversion. + */ +#if BYTE_ORDER==LITTLE_ENDIAN +#define NTOHL(d) ((d) = ntohl((d))) +#define NTOHS(d) ((d) = ntohs((d))) +#define HTONL(d) ((d) = htonl((d))) +#define HTONS(d) ((d) = htons((d))) +#else +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) +#define NTOHL(d) +#define NTOHS(d) +#define HTONL(d) +#define HTONS(d) +#endif + +#endif /*!_netinet_in_h*/ diff --git a/contrib/xntpd/include/ntp_io.h b/contrib/xntpd/include/ntp_io.h index c3b79be0616c..d60f08359b84 100644 --- a/contrib/xntpd/include/ntp_io.h +++ b/contrib/xntpd/include/ntp_io.h @@ -3,6 +3,7 @@ * SEEK_SET symbol form . */ #if defined(NTP_POSIX_SOURCE) + /* * POSIX way */ diff --git a/contrib/xntpd/include/ntp_machine.h b/contrib/xntpd/include/ntp_machine.h index 1c3983e4a9ef..16c3fbf6da83 100644 --- a/contrib/xntpd/include/ntp_machine.h +++ b/contrib/xntpd/include/ntp_machine.h @@ -44,11 +44,16 @@ Signaled IO - Signled IO defines. WHICH TERMINAL MODEL TO USE - I would assume HAVE_TERMIOS if NTP_POSIX_SOURCE was set but can't. The posix tty driver is too restrictive on most systems. - It defined if you define STREAMS. + It is defined if you define STREAMS. + We do not put these defines in the ntp_machine.h as some systems + offer multiple interfaces and refclock configuration likes to + peek into the configuration defines for tty model restrictions. + Thus all tty definitions should be in the files in the machines directory. + + HAVE_TERMIOS - Use POSIX termios.h HAVE_SYSV_TTYS - Use SYSV termio.h HAVE_BSD_TTYS - Use BSD stty.h - HAVE_TERMIOS - Use POSIX termios.h THIS MAKES PORTS TO NEW SYSTEMS EASY - You only have to wory about kernel mucking. @@ -79,6 +84,7 @@ INFO ON NEW KERNEL PLL SYS CALLS NTP_SYSCALLS_STD - use the "normal" ones NTP_SYSCALL_GET - SYS_ntp_gettime id NTP_SYSCALL_ADJ - SYS_ntp_adjtime id + NTP_SYSCALLS_LIBC - ntp_adjtime() and ntp_gettime() are in libc. HOW TO GET IP INTERFACE INFORMATION @@ -274,7 +280,6 @@ in this file. #ifndef STR_SYSTEM #define STR_SYSTEM "UNIX/Ultrix" #endif -#define HAVE_TERMIOS #endif /* @@ -297,9 +302,9 @@ in this file. #define FORCE_NTPDATE_STEP #define RETSIGTYPE void #define HAVE_ATT_SETPGRP -#define HAVE_BSD_TTYS #define LOG_NTP LOG_LOCAL1 #define HAVE_SIGNALED_IO +#define NTP_NEED_BOPS #ifndef STR_SYSTEM #define STR_SYSTEM "UNIX/AUX" #endif @@ -309,6 +314,7 @@ in this file. * Next */ #if defined(SYS_NEXT) +#define RETSIGTYPE void #define DOSYNCTODR #define HAVE_READKMEM #define HAVE_BSD_NICE @@ -329,8 +335,12 @@ in this file. #define setlinebuf(f) setvbuf(f, NULL, _IOLBF, 0) #define NO_SIGNED_CHAR_DECL #define LOCK_PROCESS -#define HAVE_NO_NICE /* HPUX uses rtprio instead */ #define RETSIGTYPE void +#if (SYS_HPUX < 9) +#define HAVE_NO_NICE /* HPUX uses rtprio instead */ +#else +#define HAVE_BSD_NICE /* new at 9.X */ +#endif #if (SYS_HPUX < 10) #define NOKMEM #else @@ -352,8 +362,6 @@ in this file. #ifndef STR_SYSTEM #define STR_SYSTEM "UNIX/BSDI" #endif -#define HAVE_BSD_TTYS -#define HAVE_TERMIOS #endif /* @@ -387,6 +395,13 @@ in this file. #define STR_SYSTEM "UNIX/*BSD" #endif #endif +#ifdef SYS_FREEBSD +#define HAVE_TERMIOS +#define HAVE_UNAME +#define HAVE_SYS_TIMEX_H +#define NTP_SYSCALLS_LIBC +#define KERNEL_PLL +#endif /* * DEC AXP OSF/1 @@ -441,9 +456,6 @@ in this file. */ #if defined(SYS_PTX) #define NO_SIGNED_CHAR_DECL -#ifndef HAVE_SYSV_TTYS -#define HAVE_SYSV_TTYS -#endif #define STREAMS_TLI #define HAVE_ATT_SETPGRP #define HAVE_SIGNALED_IO @@ -458,6 +470,7 @@ in this file. #define HAVE_READKMEM #define UDP_WILDCARD_DELIVERY #define NTP_POSIX_SOURCE +#define memmove(x, y, z) memcpy(x, y, z) struct timezone { int __0; }; /* unused placebo */ /* * no comment !@! @@ -520,6 +533,40 @@ typedef unsigned long u_long; #endif #endif +/* + * (Univel/Novell) Unixware1 SVR4 on intel x86 processor + */ +#if defined(SYS_UNIXWARE1) +/* #define _POSIX_SOURCE */ +#undef HAVE_ATT_SETPGRP +#define USE_PROTOTYPES +#define NTP_POSIX_SOURCE +#define HAVE_ATT_NICE +#define HAVE_READKMEM +#define USE_TTY_SIGPOLL +#define USE_UDP_SIGPOLL +#define UDP_WILDCARD_DELIVERY +#undef HAVE_SIGNALED_IO +#define STREAM +#define STREAMS +#ifndef STREAMS_TLI +/*#define STREAMS_TLI*/ +#endif +/* #define USE_STREAMS_DEVICE_FOR_IF_CONFIG */ +#undef STEP_SLEW /* TWO step */ +#define LOCK_PROCESS +#define NO_SIGNED_CHAR_DECL +#undef SYSV_TIMEOFDAY +#define SIZE_RETURNED_IN_BUFFER +#define RETSIGTYPE void +#include +#include +#include +#ifndef STR_SYSTEM +#define STR_SYSTEM "UNIX/Unixware1" +#endif +#endif + /* * DomainOS */ @@ -527,7 +574,6 @@ typedef unsigned long u_long; #define HAVE_BSD_NICE #define NOKMEM #define HAVE_SIGNALED_IO -#define HAVE_BSD_TTYS #define NTP_SYSCALLS_STD #define USE_PROTOTYPES #define UDP_WILDCARD_DELIVERY @@ -565,6 +611,20 @@ typedef unsigned long u_long; ERROR You_must_define_one_of_the_HAVE_xx_NICE_defines #endif +/* + * use only one tty model - no use in initialising + * a tty in three ways + * HAVE_TERMIOS is preferred over HAVE_SYSV_TTYS over HAVE_BSD_TTYS + */ +#ifdef HAVE_TERMIOS +#undef HAVE_BSD_TTYS +#undef HAVE_SYSV_TTYS +#endif + +#ifdef HAVE_SYSV_TTYS +#undef HAVE_BSD_TTYS +#endif + #if !defined(HAVE_SYSV_TTYS) \ && !defined(HAVE_BSD_TTYS) \ && !defined(HAVE_TERMIOS) diff --git a/contrib/xntpd/include/ntp_request.h b/contrib/xntpd/include/ntp_request.h index e94cb452aac7..b1a947291316 100644 --- a/contrib/xntpd/include/ntp_request.h +++ b/contrib/xntpd/include/ntp_request.h @@ -254,9 +254,8 @@ struct resp_pkt { #define REQ_GET_LEAPINFO 35 /* get leap information */ #define REQ_GET_CLOCKINFO 36 /* get clock information */ #define REQ_SET_CLKFUDGE 37 /* set clock fudge factors */ -#define REQ_SET_MAXSKEW 38 /* set the maximum skew factor */ +#define REQ_GET_KERNEL 38 /* get kernel pll/pps information */ #define REQ_GET_CLKBUGINFO 39 /* get clock debugging info */ -#define REQ_SET_SELECT_CODE 40 /* set selection algorithm */ #define REQ_SET_PRECISION 41 /* set clock precision */ @@ -267,8 +266,9 @@ struct resp_pkt { #define INFO_FLAG_SYSPEER 0x2 #define INFO_FLAG_MINPOLL 0x4 #define INFO_FLAG_REFCLOCK 0x8 +#define INFO_FLAG_MCLIENT 0x8 /* danger */ #define INFO_FLAG_BCLIENT 0x10 -#define INFO_FLAG_PREFER 0x10 /* SHARES BCLIENT bit - ok since mutually exclusive - Oh why ist flags a u_char ? */ +#define INFO_FLAG_PREFER 0x10 /* danger */ #define INFO_FLAG_AUTHENABLE 0x20 #define INFO_FLAG_SEL_CANDIDATE 0x40 #define INFO_FLAG_SHORTLIST 0x80 @@ -323,10 +323,10 @@ struct info_peer { u_char valid; /* peer.valid */ u_char reach; /* peer.reach */ u_char unreach; /* peer.unreach */ - u_char trust; /* peer.trust */ - u_char unused1; - u_char unused2; - u_char unused3; + u_char flash; /* peer.flash */ + u_char ttl; /* peer.ttl */ + u_char unused8; /* (obsolete) */ + u_char unused9; u_short associd; /* association ID */ U_LONG keyid; /* auth key in use */ U_LONG pkeyid; /* peer.pkeyid */ @@ -344,7 +344,14 @@ struct info_peer { s_fp delay; /* peer.estdelay */ u_fp dispersion; /* peer.estdisp */ l_fp offset; /* peer.estoffset */ - U_LONG bdelay[NTP_SHIFT]; /* broadcast delay filters */ + u_fp selectdisp; /* peer select dispersion */ + LONG unused1; /* (obsolete) */ + LONG unused2; + LONG unused3; + LONG unused4; + LONG unused5; + LONG unused6; + LONG unused7; U_LONG estbdelay; /* broadcast delay */ }; @@ -406,12 +413,13 @@ struct info_sys { U_LONG refid; /* reference ID of sync source */ l_fp reftime; /* system reference time */ U_LONG poll; /* system poll interval */ - u_short flags; /* system flags */ - u_char selection; /* selection algorithm code */ - u_char unused; - l_fp bdelay; /* default broadcast delay, a ts fraction */ + u_char flags; /* system flags */ + u_char unused1; /* unused */ + u_char unused2; /* unused */ + u_char unused3; /* unused */ + l_fp bdelay; /* default broadcast delay */ l_fp authdelay; /* default authentication delay */ - u_fp maxskew; /* maximum skew parameter (obsolete) */ + u_fp maxskew; /* (obsolete) */ }; @@ -419,6 +427,24 @@ struct info_sys { * System stats. These are collected in the protocol module */ struct info_sys_stats { + U_LONG timeup; /* time we have been up and running */ + U_LONG timereset; /* time since these were last cleared */ + U_LONG badstratum; /* packets claiming an invalid stratum */ + U_LONG oldversionpkt; /* old version packets received */ + U_LONG newversionpkt; /* new version packets received */ + U_LONG unknownversion; /* don't know version packets */ + U_LONG badlength; /* packets with bad length */ + U_LONG processed; /* packets processed */ + U_LONG badauth; /* packets dropped because of authorization */ + U_LONG wanderhold; /* (obsolete) */ + U_LONG limitrejected; /* rejected because of client limitation */ +}; + + +/* + * System stats - old version + */ +struct old_info_sys_stats { U_LONG timeup; /* time we have been up and running */ U_LONG timereset; /* time since these were last cleared */ U_LONG badstratum; /* packets claiming an invalid stratum */ @@ -486,7 +512,8 @@ struct conf_peer { u_char minpoll; /* min host poll interval */ u_char maxpoll; /* max host poll interval */ u_char flags; /* flags for this request */ - u_char unused; + u_char ttl; /* time to live (multicast) */ + u_short unused; /* unused */ U_LONG keyid; /* key to use for this association */ }; @@ -516,6 +543,7 @@ struct conf_sys_flags { */ #define SYS_FLAG_BCLIENT 0x1 #define SYS_FLAG_AUTHENTICATE 0x2 +#define SYS_FLAG_MCLIENT 0x4 /* * Structure used for returning restrict entries @@ -546,6 +574,7 @@ struct conf_restrict { struct info_monitor { U_LONG lasttime; /* last packet from this host */ U_LONG firsttime; /* first time we received a packet */ + U_LONG lastdrop; /* last time we rejected a packet due to client limitation policy */ U_LONG count; /* count of packets received */ U_LONG addr; /* host address */ u_short port; /* port number of last reception */ @@ -553,6 +582,18 @@ struct info_monitor { u_char version; /* version number of last packet */ }; +/* + * Structure used for returning monitor data (old format + */ +struct old_info_monitor { + U_LONG lasttime; /* last packet from this host */ + U_LONG firsttime; /* first time we received a packet */ + U_LONG count; /* count of packets received */ + U_LONG addr; /* host address */ + u_short port; /* port number of last reception */ + u_char mode; /* mode of last packet */ + u_char version; /* version number of last packet */ +}; /* * Structure used for passing indication of flags to clear @@ -711,3 +752,29 @@ struct info_clkbug { U_LONG values[NUMCBUGVALUES]; l_fp times[NUMCBUGTIMES]; }; + +/* + * Structure used for returning kernel pll/PPS information + */ +struct info_kernel { + LONG offset; + LONG freq; + LONG maxerror; + LONG esterror; + u_short status; + u_short shift; + LONG constant; + LONG precision; + LONG tolerance; + +/* + * Variables used only if PPS signal discipline is implemented + */ + LONG ppsfreq; + LONG jitter; + LONG stabil; + LONG jitcnt; + LONG calcnt; + LONG errcnt; + LONG stbcnt; +}; diff --git a/contrib/xntpd/include/ntp_stdlib.h b/contrib/xntpd/include/ntp_stdlib.h index 0ec062581616..f68c768d82d3 100644 --- a/contrib/xntpd/include/ntp_stdlib.h +++ b/contrib/xntpd/include/ntp_stdlib.h @@ -79,6 +79,7 @@ extern char * inttoa P((LONG)); extern char * mfptoa P((U_LONG, U_LONG, int)); extern char * mfptoms P((U_LONG, U_LONG, int)); extern char * modetoa P((int)); +extern U_LONG netof P((U_LONG)); extern char * numtoa P((U_LONG)); extern char * numtohost P((U_LONG)); extern int octtoint P((const char *, U_LONG *)); diff --git a/contrib/xntpd/include/ntp_timex.h b/contrib/xntpd/include/ntp_timex.h index 1756e2e07f21..cb8396ac23fe 100644 --- a/contrib/xntpd/include/ntp_timex.h +++ b/contrib/xntpd/include/ntp_timex.h @@ -1,6 +1,6 @@ /****************************************************************************** * * - * Copyright (c) David L. Mills 1993 * + * Copyright (c) David L. Mills 1993, 1994 * * * * Permission to use, copy, modify, and distribute this software and its * * documentation for any purpose and without fee is hereby granted, provided * @@ -17,12 +17,18 @@ /* * Modification history timex.h * - * 28 Nov 93 David L. Mills - * Adjusted parameters to improve stability and increase poll interval + * 19 Mar 94 David L. Mills + * Moved defines from kernel routines to header file and added new + * defines for PPS phase-lock loop. + * + * 20 Feb 94 David L. Mills + * Revised status codes and structures for external clock and PPS + * signal discipline. + * + * 28 Nov 93 David L. Mills + * Adjusted parameters to improve stability and increase poll + * interval. * - * 10 Oct 93 Torsten Duwe - * Changed to ntp_timex.h (#ifdef'd HAVE_SYS_TIMEX_H) - * * 17 Sep 93 David L. Mills * Created file */ @@ -41,7 +47,7 @@ * int syscall(SYS_ntp_gettime, tptr) * * int SYS_ntp_gettime defined in syscall.h header file - * struct ntptimeval *tptr pointer to ntptimeval structure + * struct ntptimeval *tptr pointer to ntptimeval structure * * NAME * ntp_adjtime - NTP daemon application interface @@ -55,104 +61,213 @@ * struct timex *tptr pointer to timex structure * */ -#ifndef _NTP_TIMEX_H -#define _NTP_TIMEX_H - -/* - * Include system timex.h (if appropriate) - */ -#ifdef HAVE_SYS_TIMEX_H -#include -#else /* provide definitions */ +#ifndef MSDOS /* Microsoft specific */ #include - -extern int syscall P((int, void *, ...)); - -#define ntp_gettime(t) syscall(SYS_ntp_gettime, (t)) -#define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) +#endif /* MSDOS */ /* - * The following defines establish the engineering parameters of the PLL - * model. The HZ variable establishes the timer interrupt frequency, 100 Hz - * for the SunOS kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the - * OSF/1 kernel. The SHIFT_HZ define expresses the same value as the - * nearest power of two in order to avoid hardware multiply operations. + * The following defines establish the engineering parameters of the + * phase-lock loop (PLL) model used in the kernel implementation. These + * parameters have been carefully chosen by analysis for good stability + * and wide dynamic range. + * + * The hz variable is defined in the kernel build environment. It + * establishes the timer interrupt frequency, 100 Hz for the SunOS + * kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the OSF/1 + * kernel. SHIFT_HZ expresses the same value as the nearest power of two + * in order to avoid hardware multiply operations. + * + * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen + * for a slightly underdamped convergence characteristic. + * + * MAXTC establishes the maximum time constant of the PLL. With the + * SHIFT_KG and SHIFT_KF values given and a time constant range from + * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, + * respectively. */ -#define SHIFT_HZ 7 /* log2(HZ) */ - -/* - * The SHIFT_KG and SHIFT_KF defines establish the damping of the PLL - * and are chosen by analysis for a slightly underdamped convergence - * characteristic. The MAXTC define establishes the maximum time constant - * of the PLL. With the parameters given and the default time constant of - * zero, the PLL will converge in about 15 minutes. - */ -#define SHIFT_KG 6 /* shift for phase increment */ -#define SHIFT_KF 16 /* shift for frequency increment */ +#define SHIFT_HZ 7 /* log2(hz) */ +#define SHIFT_KG 6 /* phase factor (shift) */ +#define SHIFT_KF 16 /* frequency factor (shift) */ #define MAXTC 6 /* maximum time constant (shift) */ /* - * The SHIFT_SCALE define establishes the decimal point of the time_phase - * variable which serves as a an extension to the low-order bits of the - * system clock variable. The SHIFT_UPDATE define establishes the decimal - * point of the time_offset variable which represents the current offset - * with respect to standard time. The SHIFT_USEC define represents 1 us in - * external units (shift), while the FINEUSEC define represents 1 us in - * internal units. + * The following defines establish the scaling of the various variables + * used by the PLL. They are chosen to allow the greatest precision + * possible without overflow of a 32-bit word. + * + * SHIFT_SCALE defines the scaling (shift) of the time_phase variable, + * which serves as a an extension to the low-order bits of the system + * clock variable time.tv_usec. + * + * SHIFT_UPDATE defines the scaling (shift) of the time_offset variable, + * which represents the current time offset with respect to standard + * time. + * + * SHIFT_USEC defines the scaling (shift) of the time_freq and + * time_tolerance variables, which represent the current frequency + * offset and maximum frequency tolerance. + * + * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable. */ -#define SHIFT_SCALE 23 /* shift for phase scale factor */ -#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* shift for offset scale factor */ -#define SHIFT_USEC 16 /* shift for 1 us in external units */ -#define FINEUSEC (1 << SHIFT_SCALE) /* 1 us in internal units */ +#define SHIFT_SCALE 23 /* phase scale (shift) */ +#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */ +#define SHIFT_USEC 16 /* frequency offset scale (shift) */ +#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */ /* - * Mode codes (timex.mode) + * The following defines establish the performance envelope of the PLL. + * They insure it operates within predefined limits, in order to satisfy + * correctness assertions. An excursion which exceeds these bounds is + * clamped to the bound and operation proceeds accordingly. In practice, + * this can occur only if something has failed or is operating out of + * tolerance, but otherwise the PLL continues to operate in a stable + * mode. + * + * MAXPHASE must be set greater than or equal to CLOCK.MAX (128 ms), as + * defined in the NTP specification. CLOCK.MAX establishes the maximum + * time offset allowed before the system time is reset, rather than + * incrementally adjusted. Here, the maximum offset is clamped to + * MAXPHASE only in order to prevent overflow errors due to defective + * protocol implementations. + * + * MAXFREQ is the maximum frequency tolerance of the CPU clock + * oscillator plus the maximum slew rate allowed by the protocol. It + * should be set to at least the frequency tolerance of the oscillator + * plus 100 ppm for vernier frequency adjustments. If the kernel + * PPS discipline code is configured (PPS_SYNC), the oscillator time and + * frequency are disciplined to an external source, presumably with + * negligible time and frequency error relative to UTC, and MAXFREQ can + * be reduced. + * + * MAXTIME is the maximum jitter tolerance of the PPS signal if the + * kernel PPS discipline code is configured (PPS_SYNC). + * + * MINSEC and MAXSEC define the lower and upper bounds on the interval + * between protocol updates. */ -#define ADJ_OFFSET 0x0001 /* time offset */ -#define ADJ_FREQUENCY 0x0002 /* frequency offset */ -#define ADJ_MAXERROR 0x0004 /* maximum time error */ -#define ADJ_ESTERROR 0x0008 /* estimated time error */ -#define ADJ_STATUS 0x0010 /* clock status */ -#define ADJ_TIMECONST 0x0020 /* pll time constant */ +#define MAXPHASE 128000L /* max phase error (us) */ +#ifdef PPS_SYNC +#define MAXFREQ (100L << SHIFT_USEC) /* max freq error (100 ppm) */ +#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ +#else +#define MAXFREQ (200L << SHIFT_USEC) /* max freq error (200 ppm) */ +#endif /* PPS_SYNC */ +#define MINSEC 16L /* min interval between updates (s) */ +#define MAXSEC 1200L /* max interval between updates (s) */ + +#ifdef PPS_SYNC +/* + * The following defines are used only if a pulse-per-second (PPS) + * signal is available and connected via a modem control lead, such as + * produced by the optional ppsclock feature incorporated in the Sun + * asynch driver. They establish the design parameters of the frequency- + * lock loop used to discipline the CPU clock oscillator to the PPS + * signal. + * + * PPS_AVG is the averaging factor for the frequency loop, as well as + * the time and frequency dispersion. + * + * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum + * calibration intervals, respectively, in seconds as a power of two. + * + * PPS_VALID is the maximum interval before the PPS signal is considered + * invalid and protocol updates used directly instead. + * + * MAXGLITCH is the maximum interval before a time offset of more than + * MAXTIME is believed. + */ +#define PPS_AVG 2 /* pps averaging constant (shift) */ +#define PPS_SHIFT 2 /* min interval duration (s) (shift) */ +#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ +#define PPS_VALID 120 /* pps signal watchdog max (s) */ +#define MAXGLITCH 30 /* pps signal glitch max (s) */ +#endif /* PPS_SYNC */ /* - * Clock command/status codes (timex.status) + * The following defines and structures define the user interface for + * the ntp_gettime() and ntp_adjtime() system calls. + * + * Control mode codes (timex.modes) */ -#define TIME_OK 0 /* clock synchronized */ -#define TIME_INS 1 /* insert leap second */ -#define TIME_DEL 2 /* delete leap second */ +#define MOD_OFFSET 0x0001 /* set time offset */ +#define MOD_FREQUENCY 0x0002 /* set frequency offset */ +#define MOD_MAXERROR 0x0004 /* set maximum time error */ +#define MOD_ESTERROR 0x0008 /* set estimated time error */ +#define MOD_STATUS 0x0010 /* set clock status bits */ +#define MOD_TIMECONST 0x0020 /* set pll time constant */ +#define MOD_CLKB 0x4000 /* set clock B */ +#define MOD_CLKA 0x8000 /* set clock A */ + +/* + * Status codes (timex.status) + */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ + +/* + * Clock states (time_state) + */ +#define TIME_OK 0 /* no leap second warning */ +#define TIME_INS 1 /* insert leap second warning */ +#define TIME_DEL 2 /* delete leap second warning */ #define TIME_OOP 3 /* leap second in progress */ -#define TIME_BAD 4 /* clock not synchronized */ +#define TIME_WAIT 4 /* leap second has occured */ +#define TIME_ERROR 5 /* clock not synchronized */ /* - * NTP user interface - used to read kernel clock values + * NTP user interface (ntp_gettime()) - used to read kernel clock values + * * Note: maximum error = NTP synch distance = dispersion + delay / 2; * estimated error = NTP dispersion. */ struct ntptimeval { - struct timeval time; /* current time */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ + struct timeval time; /* current time (ro) */ + LONG maxerror; /* maximum error (us) (ro) */ + LONG esterror; /* estimated error (us) (ro) */ }; /* - * NTP daemon interface - used to discipline kernel clock oscillator + * NTP daemon interface - (ntp_adjtime()) used to discipline CPU clock + * oscillator */ struct timex { - int mode; /* mode selector */ - long offset; /* time offset (usec) */ - long frequency; /* frequency offset (scaled ppm) */ - long maxerror; /* maximum error (usec) */ - long esterror; /* estimated error (usec) */ - int status; /* clock command/status */ - long time_constant; /* pll time constant */ - long precision; /* clock precision (usec) (read only) */ - long tolerance; /* clock frequency tolerance (ppm) - * (read only) - */ + unsigned int modes; /* clock mode bits (wo) */ + LONG offset; /* time offset (us) (rw) */ + LONG freq; /* frequency offset (scaled ppm) (rw) */ + LONG maxerror; /* maximum error (us) (rw) */ + LONG esterror; /* estimated error (us) (rw) */ + int status; /* clock status bits (rw) */ + LONG constant; /* pll time constant (rw) */ + LONG precision; /* clock precision (us) (ro) */ + LONG tolerance; /* clock frequency tolerance (scaled + * ppm) (ro) */ + /* + * The following read-only structure members are implemented + * only if the PPS signal discipline is configured in the + * kernel. + */ + LONG ppsfreq; /* pps frequency (scaled ppm) (ro) */ + LONG jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + LONG stabil; /* pps stability (scaled ppm) (ro) */ + LONG jitcnt; /* jitter limit exceeded (ro) */ + LONG calcnt; /* calibration intervals (ro) */ + LONG errcnt; /* calibration errors (ro) */ + LONG stbcnt; /* stability limit exceeded (ro) */ + }; - -#endif /* HAVE_SYS_TIMEX_H */ - -#endif /* _NTP_TIMEX_H */ - diff --git a/contrib/xntpd/include/ntpd.h b/contrib/xntpd/include/ntpd.h index f2c56af20b90..037e8cb366f4 100644 --- a/contrib/xntpd/include/ntpd.h +++ b/contrib/xntpd/include/ntpd.h @@ -63,6 +63,9 @@ extern void input_handler P((l_fp *)); extern void io_clr_stats P((void)); extern void io_setbclient P((void)); extern void io_unsetbclient P((void)); +extern void io_multicast_add P((U_LONG)); +extern void io_multicast_del P((U_LONG)); + extern void sendpkt P((struct sockaddr_in *, struct interface *, struct pkt *, int)); #ifdef HAVE_SIGNALED_IO extern void wait_for_signal P((void)); @@ -93,8 +96,8 @@ extern int pps_sample P((l_fp *)); /* ntp_monitor.c */ extern void init_mon P((void)); -extern void mon_start P((void)); -extern void mon_stop P((void)); +extern void mon_start P((int)); +extern void mon_stop P((int)); extern void monitor P((struct recvbuf *)); /* ntp_peer.c */ @@ -102,10 +105,10 @@ extern void init_peer P((void)); extern struct peer *findexistingpeer P((struct sockaddr_in *, struct peer *)); extern struct peer *findpeer P((struct sockaddr_in *, struct interface *)); extern struct peer *findpeerbyassoc P((int)); -extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, U_LONG)); +extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, int, U_LONG)); extern void peer_all_reset P((void)); extern void peer_clr_stats P((void)); -extern struct peer *peer_config P((struct sockaddr_in *, struct interface *, int, int, int, int, U_LONG, int)); +extern struct peer *peer_config P((struct sockaddr_in *, struct interface *, int, int, int, int, int, int, U_LONG)); extern void peer_reset P((struct peer *)); extern int peer_unconfig P((struct sockaddr_in *, struct interface *)); extern void unpeer P((struct peer *)); @@ -131,7 +134,7 @@ extern void clock_select P((void)); extern void clock_combine P((struct peer **, int)); extern void fast_xmit P((struct recvbuf *, int, int)); extern void init_proto P((void)); -extern void proto_config P((int, LONG)); +extern void proto_config P((int, U_LONG)); extern void proto_clr_stats P((void)); #ifdef REFCLOCK diff --git a/contrib/xntpd/include/parse.h b/contrib/xntpd/include/parse.h index 31041afe292f..6ce3f192754a 100644 --- a/contrib/xntpd/include/parse.h +++ b/contrib/xntpd/include/parse.h @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * /src/NTP/REPOSITORY/v3/include/parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp * - * parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp + * parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp * * Copyright (c) 1989,1990,1991,1992,1993,1994 * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg @@ -15,7 +15,7 @@ #ifndef __PARSE_H__ #define __PARSE_H__ #if !(defined(lint) || defined(__GNUC__)) - static char parsehrcsid[]="parse.h,v 3.13 1994/01/25 19:04:21 kardel Exp FAU"; + static char parsehrcsid[]="parse.h,v 3.17 1994/03/03 09:27:20 kardel Exp"; #endif #include "ntp_types.h" @@ -81,35 +81,55 @@ extern int debug; /* * state flags */ -#define PARSEB_ANNOUNCE 0x0001 /* switch time zone warning (DST switch) */ -#define PARSEB_POWERUP 0x0002 /* no synchronisation */ -#define PARSEB_NOSYNC 0x0004 /* timecode currently not confirmed */ -#define PARSEB_DST 0x0008 /* DST in effect */ -#define PARSEB_UTC 0x0010 /* UTC time */ -#define PARSEB_LEAP 0x0020 /* LEAP warning (1 hour prior to occurence) */ -#define PARSEB_ALTERNATE 0x0040 /* alternate antenna used */ -#define PARSEB_POSITION 0x0080 /* position available */ -#define PARSEB_LEAPSECOND 0x0100 /* actual leap second */ +#define PARSEB_POWERUP 0x00000001 /* no synchronisation */ +#define PARSEB_NOSYNC 0x00000002 /* timecode currently not confirmed */ -#define PARSEB_S_LEAP 0x0200 /* supports LEAP */ -#define PARSEB_S_ANTENNA 0x0400 /* supports antenna information */ -#define PARSEB_S_PPS 0x0800 /* supports PPS time stamping */ -#define PARSEB_S_POSITION 0x1000 /* supports position information (GPS) */ +/* + * time zone information + */ +#define PARSEB_ANNOUNCE 0x00000010 /* switch time zone warning (DST switch) */ +#define PARSEB_DST 0x00000020 /* DST in effect */ +#define PARSEB_UTC 0x00000040 /* UTC time */ -#define PARSEB_TIMECODE 0x2000 /* valid time code sample */ -#define PARSEB_PPS 0x4000 /* valid PPS sample */ +/* + * leap information + */ +#define PARSEB_LEAPDEL 0x00000100 /* LEAP deletion warning */ +#define PARSEB_LEAPADD 0x00000200 /* LEAP addition warning */ +#define PARSEB_LEAPS 0x00000300 /* LEAP warnings */ +#define PARSEB_LEAPSECOND 0x00000400 /* actual leap second */ +/* + * optional status information + */ +#define PARSEB_ALTERNATE 0x00001000 /* alternate antenna used */ +#define PARSEB_POSITION 0x00002000 /* position available */ + +/* + * feature information + */ +#define PARSEB_S_LEAP 0x00010000 /* supports LEAP */ +#define PARSEB_S_ANTENNA 0x00020000 /* supports antenna information */ +#define PARSEB_S_PPS 0x00040000 /* supports PPS time stamping */ +#define PARSEB_S_POSITION 0x00080000 /* supports position information (GPS) */ + +/* + * time stamp availality + */ +#define PARSEB_TIMECODE 0x10000000 /* valid time code sample */ +#define PARSEB_PPS 0x20000000 /* valid PPS sample */ #define PARSE_TCINFO (PARSEB_ANNOUNCE|PARSEB_POWERUP|PARSEB_NOSYNC|PARSEB_DST|\ - PARSEB_UTC|PARSEB_LEAP|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ + PARSEB_UTC|PARSEB_LEAPS|PARSEB_ALTERNATE|PARSEB_S_LEAP|\ PARSEB_S_LOCATION|PARSEB_TIMECODE) -#define PARSE_POWERUP(x) ((x) & PARSEB_POWERUP) -#define PARSE_NOSYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == PARSEB_NOSYNC) -#define PARSE_SYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == 0) -#define PARSE_ANNOUNCE(x) ((x) & PARSEB_ANNOUNCE) -#define PARSE_DST(x) ((x) & PARSEB_DST) +#define PARSE_POWERUP(x) ((x) & PARSEB_POWERUP) +#define PARSE_NOSYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == PARSEB_NOSYNC) +#define PARSE_SYNC(x) (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == 0) +#define PARSE_ANNOUNCE(x) ((x) & PARSEB_ANNOUNCE) +#define PARSE_DST(x) ((x) & PARSEB_DST) #define PARSE_UTC(x) ((x) & PARSEB_UTC) -#define PARSE_LEAP(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP)) +#define PARSE_LEAPADD(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPADD)) +#define PARSE_LEAPDEL(x) (PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPDEL)) #define PARSE_ALTERNATE(x) ((x) & PARSEB_ALTERNATE) #define PARSE_LEAPSECOND(x) (PARSE_SYNC(x) && ((x) & PARSEB_LEAP_SECOND)) @@ -118,9 +138,9 @@ extern int debug; #define PARSE_S_PPS(x) ((x) & PARSEB_S_PPS) #define PARSE_S_POSITION(x) ((x) & PARSEB_S_POSITION) -#define PARSE_TIMECODE(x) ((x) & PARSEB_TIMECODE) +#define PARSE_TIMECODE(x) ((x) & PARSEB_TIMECODE) #define PARSE_PPS(x) ((x) & PARSEB_PPS) -#define PARSE_POSITION(x) ((x) & PARSEB_POSITION) +#define PARSE_POSITION(x) ((x) & PARSEB_POSITION) /* * operation flags - some are also fudge flags @@ -281,6 +301,7 @@ struct clocktime /* clock time broken up from time code */ LONG second; LONG usecond; LONG utcoffset; /* in seconds */ + time_t utctime; /* the actual time - alternative to date/time */ LONG flags; /* current clock status */ }; @@ -365,6 +386,9 @@ extern unsigned LONG pps_simple P((parse_t *, int status, timestamp_t *)); * History: * * parse.h,v + * Revision 3.17 1994/03/03 09:27:20 kardel + * rcs ids fixed + * * Revision 3.13 1994/01/25 19:04:21 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/kernel/.keep_me b/contrib/xntpd/kernel/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/lib/Makefile b/contrib/xntpd/lib/Makefile index dcb4f091f82c..b6c00416c159 100644 --- a/contrib/xntpd/lib/Makefile +++ b/contrib/xntpd/lib/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.4 1993/12/22 11:32:23 rgrimes Exp $ +# $Id: Makefile,v 1.5 1994/04/03 20:37:05 wollman Exp $ # CFLAGS+= -I${.CURDIR}/../include @@ -10,7 +10,7 @@ SRCS= atoint.c atolfp.c atouint.c auth12crypt.c authdecrypt.c authdes.c \ clocktime.c dofptoa.c dolfptoa.c emalloc.c fptoa.c fptoms.c \ gettstamp.c hextoint.c hextolfp.c humandate.c inttoa.c \ lib_strbuf.c mfptoa.c mfptoms.c modetoa.c mstolfp.c \ - msutotsf.c numtoa.c refnumtoa.c numtohost.c octtoint.c \ + msutotsf.c netof.c numtoa.c refnumtoa.c numtohost.c octtoint.c \ prettydate.c ranny.c tsftomsu.c tstotv.c tvtoa.c tvtots.c \ uglydate.c uinttoa.c utvtoa.c clocktypes.c \ md5.c a_md5encrypt.c a_md5decrypt.c \ diff --git a/contrib/xntpd/lib/clocktypes.c b/contrib/xntpd/lib/clocktypes.c index 2701e3f1d0ef..816ef0708b3e 100644 --- a/contrib/xntpd/lib/clocktypes.c +++ b/contrib/xntpd/lib/clocktypes.c @@ -11,7 +11,7 @@ struct clktype clktypes[] = { { REFCLK_NONE, "unspecified type (0)", "UNKNOWN" }, { REFCLK_LOCALCLOCK, "local clock synchronization (1)", "LOCAL" }, - { REFCLK_WWV_HEATH, "Heathkit WWV clock (2)", "WWV_HEATH" }, + { REFCLK_GPS_TRAK, "TRAK 8810 GPS Receiver (2)", "GPS_TRAK" }, { REFCLK_WWV_PST, "Precision Standard Time WWV clock (3)", "WWV_PST" }, { REFCLK_WWVB_SPECTRACOM, "Spectracom WWVB clock (4)", "WWVB_SPEC" }, { REFCLK_GOES_TRUETIME, "True Time GPS/GOES clock (5)", "GPS_GOES_TRUE" }, diff --git a/contrib/xntpd/lib/netof.c b/contrib/xntpd/lib/netof.c new file mode 100644 index 000000000000..286a5846eb40 --- /dev/null +++ b/contrib/xntpd/lib/netof.c @@ -0,0 +1,25 @@ +/* + * netof - return the net address part of an ip address + * (zero out host part) + */ +#include + +#include "ntp_fp.h" +#include "ntp_stdlib.h" + +U_LONG +netof(num) + U_LONG num; +{ + register U_LONG netnum; + + netnum = num; + + if(IN_CLASSC(netnum)) + netnum &= IN_CLASSC_NET; + else if (IN_CLASSB(netnum)) + netnum &= IN_CLASSB_NET; + else /* treat als other like class A */ + netnum &= IN_CLASSA_NET; + return netnum; +} diff --git a/contrib/xntpd/lib/numtohost.c b/contrib/xntpd/lib/numtohost.c index e22b6231790a..2f07c2c4dac5 100644 --- a/contrib/xntpd/lib/numtohost.c +++ b/contrib/xntpd/lib/numtohost.c @@ -1,12 +1,11 @@ -/* numtohost.c,v 3.1 1993/07/06 01:08:40 jbj Exp +/* * numtohost - convert network number to host name. */ -#include "ntp_types.h" #include #include "ntp_fp.h" -#include "lib_strbuf.h" #include "ntp_stdlib.h" +#include "lib_strbuf.h" #define LOOPBACKNET 0x7f000000 #define LOOPBACKHOST 0x7f000001 diff --git a/contrib/xntpd/lib/systime.c b/contrib/xntpd/lib/systime.c index ea15734f1abb..1d6c59a5d969 100644 --- a/contrib/xntpd/lib/systime.c +++ b/contrib/xntpd/lib/systime.c @@ -47,12 +47,13 @@ extern int debug; * We also remember the clock precision we computed from the kernel in * case someone asks us. */ + LONG sys_clock; + LONG adj_precision; /* adj precision in usec (tickadj) */ LONG tvu_maxslew; /* maximum adjust doable in 1<> 1) /* 1/2 second */ +#endif /* * When doing adjustments, ntpdate actually overadjusts (currently diff --git a/contrib/xntpd/ntpq/ntpq.c b/contrib/xntpd/ntpq/ntpq.c index 5cfc3daff820..73c2a351aa70 100644 --- a/contrib/xntpd/ntpq/ntpq.c +++ b/contrib/xntpd/ntpq/ntpq.c @@ -75,6 +75,7 @@ int jump = 0; #define OC 12 /* integer, print in octal */ #define MD 13 /* mode */ #define AR 14 /* array of times */ +#define TST 15 /* test flags */ #define EOV 255 /* end of table */ @@ -145,7 +146,7 @@ struct ctl_var peer_var[] = { { CP_RECEIVED, UI, "received" }, /* 31 */ { CP_SENT, UI, "sent" }, /* 32 */ { CP_FILTERROR, AR, "filterror" }, /* 33 */ - { CP_FLASH, ST, "flash"}, /* 34 */ + { CP_FLASH, TST, "flash"}, /* 34 */ { CP_DISP, AR, "disp" }, /* 35 */ /* * These are duplicate entires so that we can @@ -188,6 +189,20 @@ struct codestring { char *string; }; +/* + * flasher bits + */ +static char *tstflagnames[] = { + "DUPLICATE PKT", + "BOGUS PKT", + "PROTO UNSYNC", + "PEER BOUNDS", + "BAD AUTH", + "PEER CLOCK UNSYNC", + "BAD STRATUM", + "ROOT BOUNDS" +}; + /* * Leap values */ @@ -301,7 +316,7 @@ static int decodereach P((char *, U_LONG *)); static int decodearr P((char *, int *, l_fp *)); static char * getcode P((int, struct codestring *)); static void help P((struct parse *, FILE *)); -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) static int helpsort P((const void *, const void *)); #else static int helpsort P((char **, char **)); @@ -335,7 +350,7 @@ static void output P((FILE *, char *, char *)); static void endoutput P((FILE *)); static void outputarr P((FILE *, char *, int, l_fp *)); static void cookedprint P((int, int, char *, int, FILE *)); -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) static int assoccmp P((const void *, const void *)); #else static int assoccmp P((struct association *, struct association *)); @@ -1888,7 +1903,7 @@ help(pcmd, fp) for (xcp = opcmds; xcp->keyword != 0; xcp++) cmdsort[n++] = xcp->keyword; -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) qsort((void *)cmdsort, n, sizeof(char *), helpsort); #else qsort((char *)cmdsort, n, sizeof(char *), helpsort); @@ -1934,7 +1949,7 @@ help(pcmd, fp) * helpsort - do hostname qsort comparisons */ static int -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) helpsort(t1, t2) const void *t1; const void *t2; @@ -2836,7 +2851,45 @@ outputarr(fp, name, narr, lfp) output(fp, name, buf); } +static char * +tstflags(val) + U_LONG val; +{ + register char *cb, *s; + register int i; + register char *sep; + sep = ""; + i = 0; + s = cb = &circ_buf[nextcb][0]; + if (++nextcb >= NUMCB) + nextcb = 0; + + sprintf(cb, "0x%x", val); + cb += strlen(cb); + if (val <= ((1<<8)-1)) { + if (!val) { + strcat(cb, ""); + cb += strlen(cb); + } else { + *cb++ = '<'; + while (val) { + if (val & 0x1) { + sprintf(cb, "%s%s", sep, tstflagnames[i]); + sep = ";"; + cb += strlen(cb); + } + i++; + val >>= 1; + } + *cb++ = '>'; + } + } else { + *cb++ = '?'; + } + *cb = '\0'; + return s; +} /* * cookedprint - output variables in cooked mode @@ -2994,6 +3047,13 @@ cookedprint(datatype, length, data, status, fp) outputarr(fp, name, narr, lfparr); break; + case TST: + if (!decodeuint(value, &uval)) + output_raw = '?'; + else + output(fp, name, tstflags(uval)); + break; + default: (void) fprintf(stderr, "Internal error in cookedprint, %s=%s, fmt %d\n", @@ -3028,7 +3088,7 @@ void sortassoc() { if (numassoc > 1) -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) qsort((void *)assoc_cache, numassoc, sizeof(struct association), assoccmp); #else @@ -3042,7 +3102,7 @@ sortassoc() * assoccmp - compare two associations */ static int -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) assoccmp(t1, t2) const void *t1; const void *t2; diff --git a/contrib/xntpd/parse/README.new_clocks b/contrib/xntpd/parse/README.new_clocks new file mode 100644 index 000000000000..8fdd7cbd4250 --- /dev/null +++ b/contrib/xntpd/parse/README.new_clocks @@ -0,0 +1,212 @@ +Here is an attempt to sketch out what you need to do in order to +add another clock to the parse driver: + +Prerequisites: +- Does the system you want the clock connect to have + termio.h or termios.h ? (You need that for the parse driver) + +What to do: + +Make a conversion module (parse/clk_*.c) + +- What ist the time code format ? + - find year, month, day, hour, minute, second, status (synchronised or + not), possibly time zone information (you need to give the offset to UTC) + You will have to convert the data from a string into a struct clocktime: + struct clocktime /* clock time broken up from time code */ + { + LONG day; + LONG month; + LONG year; + LONG hour; + LONG minute; + LONG second; + LONG usecond; + LONG utcoffset; /* in seconds */ + time_t utcoffset; /* true utc time instead of date/time */ + LONG flags; /* current clock status */ + }; + + Conversion is usually simple and straight forward. For the flags following + values can be OR'ed together: + + PARSEB_ANNOUNCE switch time zone warning (informational only) + PARSEB_POWERUP no synchronisation - clock confused (must set then) + PARSEB_NOSYNC timecode currently not confirmed (must set then) + usually on reception error when there is still a + chance the the generated time is still ok. + + PARSEB_DST DST in effect (informational only) + PARSEB_UTC timecode contains UTC time (informational only) + PARSEB_LEAPADD LEAP addition warning (prior to leap happening - must set when imminent) + also used for time code that do not encode the + direction (as this is currently the default). + PARSEB_LEAPDEL LEAP deletion warning (prior to leap happening - must set when imminent) + PARSEB_ALTERNATE backup transmitter (informational only) + PARSEB_POSITION geographic position available (informational only) + PARSEB_LEAPSECOND actual leap second (this time code is the leap + second - informational only) + + These are feature flags denoting items that are supported by the clock: + PARSEB_S_LEAP supports LEAP - might set PARSEB_LEAP + PARSEB_S_ANTENNA supports ANTENNA - might set PARSEB_ALTERNATE + PARSEB_S_PPS supports PPS time stamping + PARSEB_S_POSITION supports position information (GPS) + + If the utctime field is non zero this value will be take as + time code value. This allows for conversion routines that + already have the utc time value. The utctime field gives the seconds + since Jan 1st 1970, 0:00:00. The useconds field gives the respective + usec value. The fields for date and time (down to second resolution) + will be ignored. + + Conversion is done in the cvt_* routine in parse/clk_*.c files. look in + them for examples. The basic structure is: + + struct clockformat _format = { + lots of fields for you to fill out (see below) + }; + + static cvt_() + ... + { + if () { + return CVT_NONE; + } else { + if () { + ; + return CVT_OK; + } else { + return CVT_FAIL|CVT_BADFMT; + } + } + + The struct clockformat is the interface to the rest of the parse + driver - it holds all information necessary for finding the + clock message and doing the appropriate time stamping. + +struct clockformat +{ + unsigned LONG (*convert)(); + /* conversion routine - your routine - cvt_ */ + void (*syncevt)(); + /* routine for handling RS232 sync events (time stamps) - usually sync_simple */ + unsigned LONG (*syncpps)(); + /* PPS input routine - usually pps_simple */ + unsigned LONG (*synth)(); + /* time code synthesizer - usually not used - (LONG (*)())0 */ + void *data; + /* local parameters - any parameters/data/configuration info your conversion + routine might need */ + char *name; + /* clock format name - Name of the time code */ + unsigned short length; + /* maximum length of data packet for your clock format */ + unsigned LONG flags; + /* information for the parser what to look for */ + struct timeval timeout; + /* buffer restart after timeout (us) - some clocks preceede new data by + a longer period of silence - unsually not used */ + unsigned char startsym; + /* start symbol - character at the beginning of the clock data */ + unsigned char endsym; + /* end symbol - character at the end of the clock data */ + unsigned char syncsym; + /* sync symbol - character that is "on time" - where the time stamp should be taken */ +}; + + The flags: + F_START use startsym to find the beginning of the clock data + F_END use endsym to find the end of the clock data + SYNC_TIMEOUT packet restart after timeout in timeout field + SYNC_START packet start is sync event (time stamp at paket start) + SYNC_END packet end is sync event (time stamp at paket end) + SYNC_CHAR special character (syncsym) is sync event + SYNC_ONE PPS synchronize on 'ONE' transition + SYNC_ZERO PPS synchronize on 'ZERO' transition + SYNC_SYNTHESIZE generate intermediate time stamps (very special case!) + CVT_FIXEDONLY convert only in fixed configuration - (data format not + suitable for auto-configuration) + + + The above should have given you some hints on how to build a clk_*.c + file with the time code conversion. See the examples and pick a clock + closest to yours and tweak the code to match your clock. + + In order to make your clk_*.c file usable a reference to the clockformat + structure must be put into parse_conf.c. + +TTY setup and initialisation/configuration will be done in +xntpd/refclock_parse.c + +- Find out the exact tty settings for your clock (baud rate, parity, + stop bits, character size, ...) and note them in terms of + termio*.h c_cflag macros. + +- in xntpd/refclock_parse.c fill out a new the struct clockinfo element + (that allocates a new "IP" address - see comments) + (see all the other clocks for example) + struct clockinfo + { + U_LONG cl_flags; /* operation flags (io modes) */ + PARSE_F_NOPOLLONLY always do async io - read whenever input comes + PARSE_F_POLLONLY never do async io - only read when expecting data + PARSE_F_PPSPPS use loopfilter PPS code (CIOGETEV) + PARSE_F_PPSONSECOND PPS pulses are on second + usually flags stay 0 as they are used only for special setups + + void (*cl_poll)(); /* active poll routine */ + The routine to call when the clock needs data sent to it in order to + get a time code from the clock (e.g. Trimble clock) + int (*cl_init)(); /* active poll init routine */ + The routine to call for very special initializations. + void (*cl_end)(); /* active poll end routine */ + The routine to call to undo any special initialisation (free memory/timers) + void *cl_data; /* local data area for "poll" mechanism */ + local data for polling routines + u_fp cl_rootdelay; /* rootdelay */ + NTP rottdelay estimate (usually 0) + U_LONG cl_basedelay; /* current offset - unsigned l_fp fractional par + time (fraction) by which the RS232 time code is delayed from the actual time. + t */ + U_LONG cl_ppsdelay; /* current PPS offset - unsigned l_fp fractional + time (fraction) by which the PPS time stamp is delayed (usually 0) + part */ + char *cl_id; /* ID code (usually "DCF") */ + Refclock id - (max 4 chars) + char *cl_description; /* device name */ + Name of this device. + char *cl_format; /* fixed format */ + If the data format cann not ne detected automatically this is the name + as in clk_*.c clockformat. + u_char cl_type; /* clock type (ntp control) */ + Type if clock as in clock status word (ntp control messages) - usually 0 + U_LONG cl_maxunsync; /* time to trust oscillator after loosing synch + */ + seconds a clock can be trusted after loosing synchronisation. + + U_LONG cl_cflag; /* terminal io flags */ + U_LONG cl_iflag; /* terminal io flags */ + U_LONG cl_oflag; /* terminal io flags */ + U_LONG cl_lflag; /* terminal io flags */ + termio*.h tty modes. + } clockinfo[] = { + ...,,... + { < your parameters> }, + }; + + +Well, this is very sketchy, i know. But I hope it helps a little bit. +The best way is to look which clock comes closest to your and tweak that +code. +Two sorts of clocks are used with parse. Clocks that automatically send +their time code (once a second) do not need entries in the poll routines because +they send the data all the time. The second sort are the clocks that need a +command sent to them in order to reply with a time code (like the Trimble +clock). + +For questions: kardel@informatik.uni-erlangen.de. Please include +an exact description on how your clock works. (initialisation, +TTY modes, strings to be sent to it, responses received from the clock). + +Frank Kardel diff --git a/contrib/xntpd/parse/README.parse_clocks b/contrib/xntpd/parse/README.parse_clocks new file mode 100644 index 000000000000..cf8d77eb76bb --- /dev/null +++ b/contrib/xntpd/parse/README.parse_clocks @@ -0,0 +1,263 @@ +The parse driver currently supports several clocks with different +query mechanisms. In order for you to find a sample that might be +similar to a clock you might want to integrate into parse i'll sum +up the major features of the clocks (this information is distributed +in the parse/clk_*.c and xntpd/refclock_parse.c files). + +--- + Meinberg: 127.127.8. 0- 3 (PZF535TCXO) + 127.127.8. 4- 7 (PZF535OCXO) + 127.127.8. 8-11 (DCFUA31) + 127.127.8.28-31 (GPS166) + Meinberg: start=, end=, sync on start + pattern="\2D: . . ;T: ;U: . . ; \3" + pattern="\2 . . ; ; : : ; \3" + pattern="\2 . . ; ; : : ; : ; ; . . " + + Meinberg is a german manufacturer of time code receivers. Those clocks + have a pretty common output format in the stock version. In order to + support NTP Meinberg was so kind to produce some special versions of + the firmware for the use with NTP. So, if you are going to use a + Meinberg clock please ask whether there is a special Uni Erlangen + version. + + General characteristics: + Meinberg clocks primarily output pulse per second and a describing + ASCII string. This string can be produced in two modes. either upon + the reception of a question mark or every second. NTP uses the latter + mechanism. The DCF77 variants have a pretty good relationship between + RS232 time code and the PPS signal while the GPS receiver has no fixed + timeing between the datagram and the pulse (you need to use PPS with + GPS!) on DCF77 you might get away without the PPS signal. + + The preferred tty setting for Meinberg is: + CFLAG (B9600|CS7|PARENB|CREAD|HUPCL) + IFLAG (IGNBRK|IGNPAR|ISTRIP) + OFLAG 0 + LFLAG 0 + + The clock is run at datagram once per second. + Stock dataformat is: + + D:
..;T:;U:::; + pos: 0 00 00 0 00 0 11 111 1 111 12 2 22 2 22 2 2 2 3 3 3 + 1 23 45 6 78 9 01 234 5 678 90 1 23 4 56 7 8 9 0 1 2 + + = '\002' ASCII start of text + = '\003' ASCII end of text +
,, = day, month, year(2 digits!!) + = day of week (sunday= 0) + ,, = hour, minute, second + = '#' if never synced since powerup else ' ' for DCF U/A 31 + '#' if not PZF sychronisation available else ' ' for PZF 535 + = '*' if time comes from internal quartz else ' ' + = 'S' if daylight saving time is active else ' ' + = '!' during the hour preceeding an daylight saving time + start/end change + + For the university of Erlangen a special format was implemented to support + LEAP announcement and anouncement of alternate antenna. + + Version for UNI-ERLANGEN Software is: PZFUERL V4.6 (Meinberg) + + The use of this software release (or higher) is *ABSOLUTELY* + recommended (ask for PZFUERL version as some minor HW fixes have + been introduced) due to the LEAP second support and UTC indication. + The standard timecode does not indicate when the timecode is in + UTC (by front panel configuration) thus we have no chance to find + the correct utc offset. For the standard format do not ever use + UTC display as this is not detectable in the time code !!! + +
..; ; ::; + pos: 0 00 0 00 0 00 11 1 11 11 1 11 2 22 22 2 2 2 2 2 3 3 3 + 1 23 4 56 7 89 01 2 34 56 7 89 0 12 34 5 6 7 8 9 0 1 2 + = '\002' ASCII start of text + = '\003' ASCII end of text +
,, = day, month, year(2 digits!!) + = day of week (sunday= 0) + ,, = hour, minute, second + = 'U' UTC time display + = '#' if never synced since powerup else ' ' for DCF U/A 31 + '#' if not PZF sychronisation available else ' ' for PZF 535 + = '*' if time comes from internal quartz else ' ' + = 'S' if daylight saving time is active else ' ' + = '!' during the hour preceeding an daylight saving time + start/end change + = 'A' LEAP second announcement + = 'R' alternate antenna + + Meinberg GPS166 receiver + + You must get the Uni-Erlangen firmware for the GPS receiver support + to work to full satisfaction ! + +
..; ; ::; <+/-><00:00>; ; + * + 000000000111111111122222222223333333333444444444455555555556666666 + 123456789012345678901234567890123456789012345678901234567890123456 + \x0209.07.93; 5; 08:48:26; +00:00; ; 49.5736N 11.0280E 373m\x03 + * + + = '\002' ASCII start of text + = '\003' ASCII end of text +
,, = day, month, year(2 digits!!) + = day of week (sunday= 0) + ,, = hour, minute, second + <+/->,<00:00> = offset to UTC + = '#' if never synced since powerup else ' ' for DCF U/A 31 + '#' if not PZF sychronisation available else ' ' for PZF 535 + = 'U' UTC time display + = '*' if time comes from internal quartz else ' ' + = 'S' if daylight saving time is active else ' ' + = '!' during the hour preceeding an daylight saving time + start/end change + = 'A' LEAP second announcement + = 'R' alternate antenna (reminiscent of PZF535) usually ' ' + = 'L' on 23:59:60 + + + For the Meinberg parse look into clock_meinberg.c + +--- + RAWDCF: 127.127.8.20-23 (Conrad receiver module - delay 210ms) + 127.127.8.24-27 (FAU receiver - delay 258ms) + RAWDCF: end=TIMEOUT>1.5s, sync each char (any char),generate psuedo time + codes, fixed format + + direct DCF77 code input + In Europe it is relatively easy/cheap the receive the german time code + transmitter DCF77. The simplest version to process its signal is to + feed the 100/200ms pulse of the demodulated AM signal via a level + converter to an RS232 port at 50Baud. parse/clk_rawdcf.c holds all + necessary decoding logic for the time code which is transmitted each + minute for one minute. A bit of the time code is sent once a second. + + The preferred tty setting is: + CFLAG (B50|CS8|CREAD|CLOCAL) + IFLAG 0 + OFLAG 0 + LFLAG 0 + + DCF77 raw time code + + From "Zur Zeit", Physikalisch-Technische Bundesanstalt (PTB), Braunschweig + und Berlin, Maerz 1989 + + Timecode transmission: + AM: + time marks are send every second except for the second before the + next minute mark + time marks consist of a reduction of transmitter power to 25% + of the nominal level + the falling edge is the time indication (on time) + time marks of a 100ms duration constitute a logical 0 + time marks of a 200ms duration constitute a logical 1 + FM: + see the spec. (basically a (non-)inverted psuedo random phase shift) + + Encoding: + Second Contents + 0 - 10 AM: free, FM: 0 + 11 - 14 free + 15 R - alternate antenna + 16 A1 - expect zone change (1 hour before) + 17 - 18 Z1,Z2 - time zone + 0 0 illegal + 0 1 MEZ (MET) + 1 0 MESZ (MED, MET DST) + 1 1 illegal + 19 A2 - expect leap insertion/deletion (1 hour before) + 20 S - start of time code (1) + 21 - 24 M1 - BCD (lsb first) Minutes + 25 - 27 M10 - BCD (lsb first) 10 Minutes + 28 P1 - Minute Parity (even) + 29 - 32 H1 - BCD (lsb first) Hours + 33 - 34 H10 - BCD (lsb first) 10 Hours + 35 P2 - Hour Parity (even) + 36 - 39 D1 - BCD (lsb first) Days + 40 - 41 D10 - BCD (lsb first) 10 Days + 42 - 44 DW - BCD (lsb first) day of week (1: Monday -> 7: Sunday) + 45 - 49 MO - BCD (lsb first) Month + 50 MO0 - 10 Months + 51 - 53 Y1 - BCD (lsb first) Years + 54 - 57 Y10 - BCD (lsb first) 10 Years + 58 P3 - Date Parity (even) + 59 - usually missing (minute indication), except for leap insertion + +--- + Schmid clock: 127.127.8.16-19 + Schmid clock: needs poll, binary input, end='\xFC', sync start + + The Schmid clock is a DCF77 receiver that sends a binary + time code at the reception of a flag byte. The contents + if the flag byte determined the time code format. The + binary time code is delimited by the byte 0xFC. + + TTY setup is: + CFLAG (B1200|CS8|CREAD|CLOCAL) + IFLAG 0 + OFLAG 0 + LFLAG 0 + + The command to Schmid's DCF77 clock is a single byte; each bit + allows the user to select some part of the time string, as follows (the + output for the lsb is sent first). + + Bit 0: time in MEZ, 4 bytes *binary, not BCD*; hh.mm.ss.tenths + Bit 1: date 3 bytes *binary, not BCD: dd.mm.yy + Bit 2: week day, 1 byte (unused here) + Bit 3: time zone, 1 byte, 0=MET, 1=MEST. (unused here) + Bit 4: clock status, 1 byte, 0=time invalid, + 1=time from crystal backup, + 3=time from DCF77 + Bit 5: transmitter status, 1 byte, + bit 0: backup antenna + bit 1: time zone change within 1h + bit 3,2: TZ 01=MEST, 10=MET + bit 4: leap second will be + added within one hour + bits 5-7: Zero + Bit 6: time in backup mode, units of 5 minutes (unused here) + + +--- + Trimble SV6: 127.127.8.32-35 + Trimble SV6: needs poll, ascii timecode, start='>', end='<', + query='>QTM<', eol='<' + + Trimble SV6 is a GPS receiver with PPS output. It needs to be polled. + It also need a special tty mode setup (EOL='<'). + + TTY setup is: + CFLAG (B4800|CS8|CREAD) + IFLAG (BRKINT|IGNPAR|ISTRIP|ICRNL|IXON) + OFLAG (OPOST|ONLCR) + LFLAG (ICANON|ECHOK) + + Special flags are: + PARSE_F_PPSPPS - use CIOGETEV for PPS time stamping + PARSE_F_PPSONSECOND - the time code is not related to + the PPS pulse (so use the time code + only for the second epoch) + + Timecode + 0000000000111111111122222222223333333 / char + 0123456789012345678901234567890123456 \ posn + >RTMhhmmssdddDDMMYYYYoodnnvrrrrr;*xx< Actual + ----33445566600112222BB7__-_____--99- Parse + >RTM 1 ;* <", Check + +--- + ELV DCF7000: 127.127.8.12-15 + ELV DCF7000: end='\r', pattern=" - - - - - - - \r" + + The ELV DCF7000 is a cheap DCF77 receiver sending each second + a time code (though not very precise!) delimited by '`r' + + Timecode + YY-MM-DD-HH-MM-SS-FF\r + + FF&0x1 - DST + FF&0x2 - DST switch warning + FF&0x4 - unsynchronised + diff --git a/contrib/xntpd/parse/clk_dcf7000.c b/contrib/xntpd/parse/clk_dcf7000.c index 5655d0a017f0..8b55e2f23280 100644 --- a/contrib/xntpd/parse/clk_dcf7000.c +++ b/contrib/xntpd/parse/clk_dcf7000.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_DCF7000) /* - * /src/NTP/REPOSITORY/v3/parse/clk_dcf7000.c,v 3.10 1994/01/25 19:05:07 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_dcf7000.c,v 3.11 1994/02/02 17:45:14 kardel Exp * - * clk_dcf7000.c,v 3.10 1994/01/25 19:05:07 kardel Exp + * clk_dcf7000.c,v 3.11 1994/02/02 17:45:14 kardel Exp * * ELV DCF7000 module * @@ -121,6 +121,9 @@ cvt_dcf7000(buffer, size, format, clock) * History: * * clk_dcf7000.c,v + * Revision 3.11 1994/02/02 17:45:14 kardel + * rcs ids fixed + * * Revision 3.6 1993/10/09 15:01:27 kardel * file structure unified * diff --git a/contrib/xntpd/parse/clk_meinberg.c b/contrib/xntpd/parse/clk_meinberg.c index b08dfec91152..69f88b90d30e 100644 --- a/contrib/xntpd/parse/clk_meinberg.c +++ b/contrib/xntpd/parse/clk_meinberg.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_MEINBERG) /* - * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.11 1994/01/25 19:05:10 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_meinberg.c,v 3.14 1994/02/20 13:04:37 kardel Exp * - * clk_meinberg.c,v 3.11 1994/01/25 19:05:10 kardel Exp + * clk_meinberg.c,v 3.14 1994/02/20 13:04:37 kardel Exp * * Meinberg clock support * @@ -284,8 +284,13 @@ cvt_meinberg(buffer, size, format, clock) clock->flags |= PARSEB_S_LEAP; clock->flags |= PARSEB_S_ANTENNA; + /* + * DCF77 does not encode the direction - + * so we take the current default - + * earth slowing down + */ if (f[4] == 'A') - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; if (f[5] == 'R') clock->flags |= PARSEB_ALTERNATE; @@ -394,9 +399,12 @@ cvt_mgps(buffer, size, format, clock) /* * oncoming leap second + * data format does not (yet) specify whether + * to add or to delete a second - thus we + * pick the current default */ if (f[5] == 'A') - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; /* * this is the leap second @@ -414,6 +422,12 @@ cvt_mgps(buffer, size, format, clock) * History: * * clk_meinberg.c,v + * Revision 3.14 1994/02/20 13:04:37 kardel + * parse add/delete second support + * + * Revision 3.13 1994/02/02 17:45:21 kardel + * rcs ids fixed + * * Revision 3.11 1994/01/25 19:05:10 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/clk_rawdcf.c b/contrib/xntpd/parse/clk_rawdcf.c index 2fd3cae20b89..6b02031b6394 100644 --- a/contrib/xntpd/parse/clk_rawdcf.c +++ b/contrib/xntpd/parse/clk_rawdcf.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_RAWDCF) /* - * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.9 1994/01/25 19:05:12 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_rawdcf.c,v 3.13 1994/03/10 19:00:43 kardel Exp * - * clk_rawdcf.c,v 3.9 1994/01/25 19:05:12 kardel Exp + * clk_rawdcf.c,v 3.13 1994/03/10 19:00:43 kardel Exp * * Raw DCF77 pulse clock support * @@ -245,6 +245,7 @@ static unsigned LONG convert_rawdcf(buffer, size, dcfparam, clock) parseprintf(DD_RAWDCF,("parse: convert_rawdcf: parity check passed\n")); clock->flags = PARSEB_S_ANTENNA|PARSEB_S_LEAP; + clock->utctime= 0; clock->usecond= 0; clock->second = 0; clock->minute = ext_bf(buffer, DCF_M10, dcfparam->zerobits); @@ -278,7 +279,7 @@ static unsigned LONG convert_rawdcf(buffer, size, dcfparam, clock) clock->flags |= PARSEB_ANNOUNCE; if (ext_bf(buffer, DCF_A2, dcfparam->zerobits)) - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ if (ext_bf(buffer, DCF_R, dcfparam->zerobits)) clock->flags |= PARSEB_ALTERNATE; @@ -529,6 +530,15 @@ static unsigned LONG snt_rawdcf(parseio, ptime) * History: * * clk_rawdcf.c,v + * Revision 3.13 1994/03/10 19:00:43 kardel + * clear utctime field to avoid confusion on synthesize time stamps + * + * Revision 3.12 1994/02/20 13:04:39 kardel + * parse add/delete second support + * + * Revision 3.11 1994/02/02 17:45:23 kardel + * rcs ids fixed + * * Revision 3.9 1994/01/25 19:05:12 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/clk_schmid.c b/contrib/xntpd/parse/clk_schmid.c index a8ec8a64b546..8129474782bb 100644 --- a/contrib/xntpd/parse/clk_schmid.c +++ b/contrib/xntpd/parse/clk_schmid.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_SCHMID) /* - * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.10 1994/01/25 19:05:15 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_schmid.c,v 3.13 1994/02/20 13:04:41 kardel Exp * - * clk_schmid.c,v 3.10 1994/01/25 19:05:15 kardel Exp + * clk_schmid.c,v 3.13 1994/02/20 13:04:41 kardel Exp * * Schmid clock support * @@ -152,7 +152,7 @@ cvt_schmid(buffer, size, format, clock) if (buffer[8] & WS_LEAP) { - clock->flags |= PARSEB_LEAP; + clock->flags |= PARSEB_LEAPADD; /* default: DCF77 data format deficiency */ } } @@ -168,6 +168,12 @@ cvt_schmid(buffer, size, format, clock) * History: * * clk_schmid.c,v + * Revision 3.13 1994/02/20 13:04:41 kardel + * parse add/delete second support + * + * Revision 3.12 1994/02/02 17:45:25 kardel + * rcs ids fixed + * * Revision 3.10 1994/01/25 19:05:15 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/clk_trimble.c b/contrib/xntpd/parse/clk_trimble.c index bfbf1e6bc796..187aed52a4d7 100644 --- a/contrib/xntpd/parse/clk_trimble.c +++ b/contrib/xntpd/parse/clk_trimble.c @@ -1,6 +1,6 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) && defined(CLOCK_TRIMSV6) /* - * /src/NTP/REPOSITORY/v3/parse/clk_trimble.c,v 3.7 1994/01/25 19:05:17 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/clk_trimble.c,v 3.9 1994/02/02 17:45:27 kardel Exp * * Trimble SV6 clock support */ @@ -106,6 +106,9 @@ cvt_trimsv6(buffer, size, format, clock) * History: * * clk_trimble.c,v + * Revision 3.9 1994/02/02 17:45:27 kardel + * rcs ids fixed + * * Revision 3.7 1994/01/25 19:05:17 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/parse.c b/contrib/xntpd/parse/parse.c index ed5fd9a8fad7..84bfa39d1293 100644 --- a/contrib/xntpd/parse/parse.c +++ b/contrib/xntpd/parse/parse.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp * - * parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp + * parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp * * Parser module for reference clock * @@ -29,6 +29,10 @@ static char rcsid[] = "parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp"; #include "sys/time.h" #include "sys/errno.h" +#include "ntp_fp.h" +#include "ntp_unixtime.h" +#include "ntp_calendar.h" + #include "ntp_machine.h" #if defined(PARSESTREAM) && (defined(SYS_SUNOS4) || defined(SYS_SOLARIS)) && defined(STREAM) @@ -49,10 +53,6 @@ static char rcsid[] = "parse.c,v 3.19 1994/01/25 19:05:20 kardel Exp"; #endif #endif -#include "ntp_fp.h" -#include "ntp_unixtime.h" -#include "ntp_calendar.h" - #include "parse.h" #include "ntp_stdlib.h" @@ -178,6 +178,10 @@ setup_bitmaps(parseio, low, high) { fmt = clockformats[i]; + if (!(parseio->parse_flags & PARSE_FIXED_FMT) && + (fmt->flags & CVT_FIXEDONLY)) + continue; + if (fmt->flags & F_START) { index = fmt->startsym / 8; @@ -556,6 +560,9 @@ parse_to_unixtime(clock, cvtrtc) register int i; time_t t; + if (clock->utctime) + return clock->utctime; /* if the conversion routine gets it right away - why not */ + if (clock->year < 100) clock->year += 1900; @@ -628,6 +635,9 @@ parse_to_unixtime(clock, cvtrtc) t += clock->utcoffset; /* warp to UTC */ /* done */ + + clock->utctime = t; /* documentray only */ + return t; } @@ -890,6 +900,8 @@ timepacket(parseio) if (parseio->parse_flags & PARSE_FIXED_FMT) { + clock.utctime = 0; + switch ((cvtrtc = clockformats[format]->convert ? clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : CVT_NONE) & CVT_MASK) { case CVT_FAIL: @@ -941,6 +953,8 @@ timepacket(parseio) { do { + clock.utctime = 0; + switch ((cvtrtc = (clockformats[format]->convert && !(clockformats[format]->flags & CVT_FIXEDONLY)) ? clockformats[format]->convert(parseio->parse_data, parseio->parse_index, clockformats[format]->data, &clock) : CVT_NONE) & CVT_MASK) @@ -1148,6 +1162,15 @@ parse_setcs(dct, parse) * History: * * parse.c,v + * Revision 3.23 1994/03/25 13:09:02 kardel + * considering FIXEDONLY entries only in FIXEDONLY mode + * + * Revision 3.22 1994/02/25 12:34:49 kardel + * allow for converter generated utc times + * + * Revision 3.21 1994/02/02 17:45:30 kardel + * rcs ids fixed + * * Revision 3.19 1994/01/25 19:05:20 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/parse_conf.c b/contrib/xntpd/parse/parse_conf.c index 0281c9dd1071..238dd1234e66 100644 --- a/contrib/xntpd/parse/parse_conf.c +++ b/contrib/xntpd/parse/parse_conf.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/parse/parse_conf.c,v 3.13 1994/01/25 19:05:23 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parse_conf.c,v 3.15 1994/02/02 17:45:32 kardel Exp * - * parse_conf.c,v 3.13 1994/01/25 19:05:23 kardel Exp + * parse_conf.c,v 3.15 1994/02/02 17:45:32 kardel Exp * * Parser configuration module for reference clocks * @@ -81,6 +81,9 @@ unsigned short nformats = sizeof(clockformats) / sizeof(clockformats[0]) - 1; * History: * * parse_conf.c,v + * Revision 3.15 1994/02/02 17:45:32 kardel + * rcs ids fixed + * * Revision 3.13 1994/01/25 19:05:23 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/parsesolaris.c b/contrib/xntpd/parse/parsesolaris.c index 09fac2861f0c..23bc252e8fce 100644 --- a/contrib/xntpd/parse/parsesolaris.c +++ b/contrib/xntpd/parse/parsesolaris.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp * - * parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp + * parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp * * STREAMS module for reference clocks * (SunOS5.x - not fully tested - buyer beware ! - OS KILLERS may still be @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "parsesolaris.c,v 3.9 1994/01/25 19:05:26 kardel Exp"; +static char rcsid[] = "parsesolaris.c,v 3.15 1994/02/15 22:20:51 kardel Exp"; #endif /* @@ -65,7 +65,7 @@ static struct fmodsw fmod_templ = { "parse", /* module name */ &parseinfo, /* module information */ - 0, /* not clean yet */ + D_NEW|D_MP|D_MTQPAIR, /* exclusive for q pair */ /* lock ptr */ }; @@ -139,7 +139,7 @@ int Strcmp(s, t) /*ARGSUSED*/ int _init(void) { - static char revision[] = "3.9"; + static char revision[] = "3.15"; char *s, *S, *t; /* @@ -413,6 +413,8 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) parse->parse_ppsclockev.tv.tv_usec = 0; parse->parse_ppsclockev.serial = 0; + qprocson(q); + parseprintf(DD_OPEN,("parse: OPEN - initializing io subsystem q=%x\n", q)); if (!parse_ioinit(&parse->parse_io)) @@ -420,6 +422,8 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) /* * ok guys - beat it */ + qprocsoff(q); + kmem_free((caddr_t)parse, sizeof(parsestream_t)); parsebusy--; @@ -441,7 +445,7 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) */ if (!notice) { - printf("%s: Copyright (c) 1991-1993, Frank Kardel\n", modlstrmod.strmod_linkinfo); + printf("%s: Copyright (c) 1991-1994, Frank Kardel\n", modlstrmod.strmod_linkinfo); notice = 1; } @@ -449,7 +453,12 @@ static int parseopen(queue_t *q, dev_t *dev, int flag, int sflag, cred_t *credp) } else { + qprocsoff(q); + + kmem_free((caddr_t)parse, sizeof(parsestream_t)); + parsebusy--; + return EIO; } } @@ -462,6 +471,8 @@ static int parseclose(queue_t *q, int flags) parseprintf(DD_CLOSE,("parse: CLOSE\n")); + qprocsoff(q); + s = splhigh(); if (parse->parse_dqueue) @@ -1179,6 +1190,18 @@ static void zs_xsisr(struct zscom *zs) * History: * * parsesolaris.c,v + * Revision 3.15 1994/02/15 22:20:51 kardel + * rcsid fixed + * + * Revision 3.14 1994/02/15 22:06:04 kardel + * added qprocsx & flags for MT capability + * + * Revision 3.13 1994/02/13 19:16:47 kardel + * updated verbose Copyright message + * + * Revision 3.12 1994/02/02 17:45:35 kardel + * rcs ids fixed + * * Revision 3.9 1994/01/25 19:05:26 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/parsestreams.c b/contrib/xntpd/parse/parsestreams.c index b371aedafcee..45d296337a69 100644 --- a/contrib/xntpd/parse/parsestreams.c +++ b/contrib/xntpd/parse/parsestreams.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp * - * parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp + * parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp * * STREAMS module for reference clocks * (SunOS4.x) @@ -16,7 +16,7 @@ */ #ifndef lint -static char rcsid[] = "parsestreams.c,v 3.12 1994/01/25 19:05:30 kardel Exp"; +static char rcsid[] = "parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp"; #endif #include "sys/types.h" @@ -195,7 +195,7 @@ int xxxinit(fc, vdp, vdi, vds) } else { - static char revision[] = "3.12"; + static char revision[] = "3.19"; char *s, *S, *t; strncpy(ifm->f_name, mname, FMNAMESZ); @@ -527,7 +527,7 @@ static int parseopen(q, dev, flag, sflag) */ if (!notice) { - printf("%s: Copyright (c) 1991-1993, Frank Kardel\n", parsesync_vd.Drv_name); + printf("%s: Copyright (c) 1991-1994, Frank Kardel\n", parsesync_vd.Drv_name); notice = 1; } @@ -535,6 +535,8 @@ static int parseopen(q, dev, flag, sflag) } else { + kmem_free((caddr_t)parse, sizeof(parsestream_t)); + #ifdef VDDRV parsebusy--; #endif @@ -1074,6 +1076,11 @@ static void close_zs_linemon(q, my_q) #define MAXDEPTH 50 /* maximum allowed stream crawl */ +#ifdef PPS_SYNC +extern hardpps(); +extern struct timeval time; +#endif + /* * take external status interrupt (only CD interests us) */ @@ -1085,15 +1092,18 @@ static void zs_xsisr(zs) register queue_t *q; register unsigned char zsstatus; register int loopcheck; - register unsigned char cdstate; register char *dname; +#ifdef PPS_SYNC + register int s; + register long usec; +#endif /* * pick up current state */ zsstatus = zsaddr->zscc_control; - if (za->za_rr0 ^ (cdstate = zsstatus & ZSRR0_CD)) + if ((za->za_rr0 ^ zsstatus) & (ZSRR0_CD|ZSRR0_SYNC)) { timestamp_t cdevent; register int status; @@ -1101,26 +1111,44 @@ static void zs_xsisr(zs) /* * CONDITIONAL external measurement support */ - SET_LED(cdstate); /* + SET_LED(zsstatus & (ZSRR0_CD|ZSRR0_SYNC)); /* * inconsistent with upper SET_LED, but this * is for oscilloscope business anyway and we * are just interested in edge delays in the * lower us range */ - +#ifdef PPS_SYNC + s = splclock(); + usec = time.tv_usec; +#endif /* * time stamp */ uniqtime(&cdevent.tv); - - TIMEVAL_USADD(&cdevent.tv, xsdelay); - - q = za->za_ttycommon.t_readq; + +#ifdef PPS_SYNC + splx(s); +#endif /* * logical state */ - status = cd_invert ? cdstate == 0 : cdstate != 0; + status = cd_invert ? (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) == 0 : (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) != 0; + +#ifdef PPS_SYNC + if (status) + { + usec = cdevent.tv.tv_usec - usec; + if (usec < 0) + usec += 1000000; + + hardpps(&cdevent.tv, usec); + } +#endif + + TIMEVAL_USADD(&cdevent.tv, xsdelay); + + q = za->za_ttycommon.t_readq; /* * ok - now the hard part - find ourself @@ -1177,10 +1205,10 @@ static void zs_xsisr(zs) /* * only pretend that CD has been handled */ - za->za_rr0 = za->za_rr0 & ~ZSRR0_CD | zsstatus & ZSRR0_CD; + za->za_rr0 = za->za_rr0 & ~(ZSRR0_CD|ZSRR0_SYNC) | zsstatus & (ZSRR0_CD|ZSRR0_SYNC); ZSDELAY(2); - if (!((za->za_rr0 ^ zsstatus) & ~ZSRR0_CD)) + if (!((za->za_rr0 ^ zsstatus) & ~(ZSRR0_CD|ZSRR0_SYNC))) { /* * all done - kill status indication and return @@ -1258,6 +1286,24 @@ static void zs_xsisr(zs) * History: * * parsestreams.c,v + * Revision 3.19 1994/02/24 16:33:54 kardel + * CD events can also be posted on sync flag + * + * Revision 3.18 1994/02/24 14:12:58 kardel + * initial PPS_SYNC support version + * + * Revision 3.17 1994/02/20 15:18:02 kardel + * rcs id cleanup + * + * Revision 3.16 1994/02/15 22:39:50 kardel + * memory leak on open failure closed + * + * Revision 3.15 1994/02/13 19:16:50 kardel + * updated verbose Copyright message + * + * Revision 3.14 1994/02/02 17:45:38 kardel + * rcs ids fixed + * * Revision 3.12 1994/01/25 19:05:30 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/parse/util/parsetest.c b/contrib/xntpd/parse/util/parsetest.c index 9028b4cf4cf4..21e41289a1c6 100644 --- a/contrib/xntpd/parse/util/parsetest.c +++ b/contrib/xntpd/parse/util/parsetest.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/kernel/parsetest.c,v 3.4 1993/03/17 17:16:57 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/util/parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp * - * parsetest.c,v 3.10 1994/01/23 17:22:18 kardel Exp + * parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp * * Copyright (c) 1989,1990,1991,1992,1993,1994 * Frank Kardel Friedrich-Alexander Universitaet Erlangen-Nuernberg @@ -11,15 +11,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * parsetest.c,v - * Revision 3.4 1993/03/17 17:16:57 kardel - * DEC OSF/1 ALPHA Integration - 930314 + * Revision 3.13 1994/02/20 13:04:46 kardel + * parse add/delete second support * - * Revision 3.3 1993/01/18 09:24:33 kardel - * updated copyright conditions in conjunction with - * conditions set up in the COPYRIGHT file - * - * Revision 3.2 1993/01/17 13:43:00 kardel - * 1993 initial update + * Revision 3.12 1994/02/02 17:45:51 kardel + * rcs ids fixed * */ @@ -198,7 +194,7 @@ main(argc, argv) parsetime_t parsetime; struct strioctl strioc; - printf("parsetest.c,v 3.10 1994/01/23 17:22:18 kardel Exp\n"); + printf("parsetest.c,v 3.13 1994/02/20 13:04:46 kardel Exp\n"); while (ioctl(fd, I_POP, 0) == 0) ; diff --git a/contrib/xntpd/parse/util/testdcf.c b/contrib/xntpd/parse/util/testdcf.c index ebdfd2fded07..560ab27c4369 100644 --- a/contrib/xntpd/parse/util/testdcf.c +++ b/contrib/xntpd/parse/util/testdcf.c @@ -1,7 +1,7 @@ /* - * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * /src/NTP/REPOSITORY/v3/parse/util/testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp * - * testdcf.c,v 3.9 1994/01/25 19:05:45 kardel Exp + * testdcf.c,v 3.11 1994/02/02 17:45:55 kardel Exp * * simple DCF77 100/200ms pulse test program (via 50Baud serial line) * diff --git a/contrib/xntpd/ppsclock/ppstest/.keep_me b/contrib/xntpd/ppsclock/ppstest/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/genassym/.keep_me b/contrib/xntpd/ppsclock/sys/genassym/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/os/.keep_me b/contrib/xntpd/ppsclock/sys/os/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/sun/.keep_me b/contrib/xntpd/ppsclock/sys/sun/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/sun4c/.keep_me b/contrib/xntpd/ppsclock/sys/sun4c/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/sun4c/conf/.keep_me b/contrib/xntpd/ppsclock/sys/sun4c/conf/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/sun4m/conf/.keep_me b/contrib/xntpd/ppsclock/sys/sun4m/conf/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/sundev/.keep_me b/contrib/xntpd/ppsclock/sys/sundev/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/ppsclock/sys/sys/.keep_me b/contrib/xntpd/ppsclock/sys/sys/.keep_me deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contrib/xntpd/refclocks/rclk.TRAK b/contrib/xntpd/refclocks/rclk.TRAK new file mode 100644 index 000000000000..188ffd4445bc --- /dev/null +++ b/contrib/xntpd/refclocks/rclk.TRAK @@ -0,0 +1,29 @@ +#!/bin/sh - +CMD="$1" +shift; + +. refclocks/setup + +case "$CMD" in + info) + echo " TRAK - TRAK 8810 GPS station clock" + ;; + check) + if check "$RCONFIG" '$0 ~ /TRAK/'; then + echo "TRAK - TRAK 8810 GPS station clock" + fi + ;; + config) + if check "$REFCONF" '$0 ~ /TRAK/' || + ( [ ! "$REFCONF" ] && query "Include TRAK 8810 GPS station clock (TRAK)" n); then + if check "$PPSFEATURES" '$0 ~ /CD/' && + [ "$PPSOK" -eq 1 ] && + (check "$REFCONF" '$0 ~ /TRAKPPS/' || + ( [ ! "$REFCONF" ] && query " Use TRAK for PPS" n)); then + echo "-DTRAKPPS" >> $RCONFIG + else + echo "-DTRAK" >> $RCONFIG + fi + fi + ;; +esac diff --git a/contrib/xntpd/scripts/Guess.sh b/contrib/xntpd/scripts/Guess.sh index c2be5697eab7..88dcb1a5ef86 100755 --- a/contrib/xntpd/scripts/Guess.sh +++ b/contrib/xntpd/scripts/Guess.sh @@ -40,7 +40,11 @@ if [ -f /bin/uname -o -f /usr/bin/uname ]; then guess="ultrix" ;; hp-ux) case "$3" in - *.10.*) guess="hpux10+" ;; + *.10.*) guess="hpux-adj" ;; + *.09.03) case "$5" in + 9000/3*) guess="hpux-adj" ;; + *) guess="hpux" ;; + esac ;; *) guess="hpux" ;; esac ;; @@ -74,7 +78,7 @@ if [ -f /bin/uname -o -f /usr/bin/uname ]; then 3.2.*) case "$4" in v*) - (i386) >/dev/null 2>&1 && guess=ptx;; + (i386) >/dev/null 2>&1 && [ -f /usr/lib/libseq.a ] && guess=ptx;; esac esac fi diff --git a/contrib/xntpd/scripts/README b/contrib/xntpd/scripts/README index 79f1792a43d4..7439c6c6c498 100644 --- a/contrib/xntpd/scripts/README +++ b/contrib/xntpd/scripts/README @@ -11,7 +11,7 @@ Guess.sh script to figure out what machine and operating system autoconf awesome script swiped from Jeff Johnson (who may have swiped it from GNU) which delves deep into the system files to reveal dark secrets necessary to port NTP to - everything exceptt sewing machines. Unfinished work. + everything except sewing machines. Unfinished work. makeconfig.sh shell script that calles Guess.sh and then figures out what compiler is available, then builds the diff --git a/contrib/xntpd/scripts/stats/README b/contrib/xntpd/scripts/stats/README index 5aa64d4c1db9..680896342acb 100644 --- a/contrib/xntpd/scripts/stats/README +++ b/contrib/xntpd/scripts/stats/README @@ -3,20 +3,27 @@ Statistics processing scripts (README) This directory contains a number of scripts for use with the filegen facility. Those files ending in .awk are for the Unix awk utility, while those ending in .sh are for the csh utility. Normally, the summary.sh -script is called from a cron job once per day. This script calls the -peer.sh script to process the peerstats file and append the summary -statistics to the peer_summary file. Then, it callse the loop.sh script -to process the loopstats file and append the summary statistics to the -loop_summary file. Finally, it calls the clock.sh script to process the -clockstats file and append the summary statistics to the clock_summary -file. +script is called from a cron job once per day. This script processes the +daily loopstats, peerstats and clockstats files produced by the daemon, +updates the loop_summary, peer_summary and clock_summary archive files, +and deletes the daily files. -Each of the three shell scripts peer.sh, loop.sh and clock.sh invoke -one or more awk scripts to actually produce the data. This may result -in multiple scans of the same input file. The input file is deleted after -processing. In fact, the shell scripts will process all input files -found of the correct type in chronological order, deleting each one as -it is scanned, except the current day file. +In the case of the Austron 2201A GPS receiver, the clockstats file +contains a wealth of additional monitoring data. These data are summarized +and writted to the clock_summary file, then a series of special files are +constructed for later processing by the S utility. + +The summary.sh script invokes a number of awk scripts to actually produce +the data. This may result in multiple scans of the same input file. +The input file is deleted after processing. In fact, the shell scripts will +process all input files found of the correct type in chronological order, +deleting each one as it is scanned, except the current day file. + +The summary.sh script can produce input files for the S utility, if it +is found on the search path. This utility makes PostScript graphs of the +loopstats data for each day, as well as various statistics produced by +the Austorn 220aA GPS receiver. The S utility is automatically run +as a background job. Its control files have the .S extension. The psummary.awk script can be used to scan the peer_summary file and construct an historical reprise of the daily summaries. @@ -29,4 +36,4 @@ David L. Mills University of Delaware mills@udel.edu 1 November 1993 - +Revised 12 April 1994 diff --git a/contrib/xntpd/scripts/stats/dupe.awk b/contrib/xntpd/scripts/stats/dupe.awk index 3ddc1b6f9754..317c2a4faf84 100644 --- a/contrib/xntpd/scripts/stats/dupe.awk +++ b/contrib/xntpd/scripts/stats/dupe.awk @@ -1,4 +1,5 @@ -# program to delete duplicate lines in a file +# +# delete duplicate lines # { if (old != $0) diff --git a/contrib/xntpd/scripts/stats/ensemble.S b/contrib/xntpd/scripts/stats/ensemble.S new file mode 100644 index 000000000000..32a4dbabb820 --- /dev/null +++ b/contrib/xntpd/scripts/stats/ensemble.S @@ -0,0 +1,5 @@ +ensemble <- scan(file1, list(day=0, sec=0, gps=0, gpsw=0, loran=0, loranw=0, ensemble=0, std=0)) +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck = 0.03, mar = c(2, 2, 1, 1)) +plot(ensemble$sec, ensemble$ensemble, type="l", xlab=paste("MJD", ensemble$day, "Time (s)"), ylab="Ensemble Offset (ns)", ylim=c(-400, 400)) diff --git a/contrib/xntpd/scripts/stats/etf.S b/contrib/xntpd/scripts/stats/etf.S new file mode 100644 index 000000000000..9b9c68b937b5 --- /dev/null +++ b/contrib/xntpd/scripts/stats/etf.S @@ -0,0 +1,15 @@ +options(digits=4) +file2 <- "etf_summary" +etf <- scan(file1, list(day=0, sec=0, offset=0, stab=0)) +r <- lsfit(etf$sec, etf$offset) +count<-length(etf$sec) +mean<-r$coef[[1]] +std<-sqrt(var(r$residuals)) +slope<-r$coef[[2]] * 1000 +cat("\n", file=file2 , append=TRUE, fill=FALSE, sep="") +cat(file1, "\n", file=file2, append=TRUE, fill=FALSE, sep="") +cat("etf1 ", count, ", T ", mean, " ns, R ", slope, " ps/s, std ", std, " us\n", file=file2, append=TRUE, fill=FALSE, sep="") +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(etf$sec, etf$offset, type="l", xlab=paste("MJD", etf$day, "Time (s)"), ylab="External Offset (ns)", ylim=c(-400, 400)) diff --git a/contrib/xntpd/scripts/stats/itf.S b/contrib/xntpd/scripts/stats/itf.S new file mode 100644 index 000000000000..56c8c8d0cc7a --- /dev/null +++ b/contrib/xntpd/scripts/stats/itf.S @@ -0,0 +1,5 @@ +itf <- scan(file1, list(day=0, sec=0, offset=0, stab=0)) +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(itf$sec, itf$offset, type="l", xlab=paste("MJD", itf$day, "Time (s)"), ylab="Internal Offset (ns)", ylim=c(-400, 400)) diff --git a/contrib/xntpd/scripts/stats/loop.S b/contrib/xntpd/scripts/stats/loop.S new file mode 100644 index 000000000000..8e564b67eb67 --- /dev/null +++ b/contrib/xntpd/scripts/stats/loop.S @@ -0,0 +1,7 @@ +options(digits=4) +loop <- scan(file1, list(day=0, sec=0, offset=0, freq=0, tc=0)) +loop$offset <- loop$offset * 1e6 +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(loop$sec, loop$offset, type="l", xlab=paste("MJD", loop$day, "Time (s)"), ylab="PLL Offset (us)", ylim=c(-400, 400)) diff --git a/contrib/xntpd/scripts/stats/loop.awk b/contrib/xntpd/scripts/stats/loop.awk index 25d0bdb97d53..470b27c8bef5 100644 --- a/contrib/xntpd/scripts/stats/loop.awk +++ b/contrib/xntpd/scripts/stats/loop.awk @@ -35,15 +35,7 @@ BEGIN { loop_time_rms = sqrt(loop_time_rms / loop_count - loop_time * loop_time) loop_freq /= loop_count loop_freq_rms = sqrt(loop_freq_rms / loop_count - loop_freq * loop_freq) - loop_tmax = loop_tmax - loop_time - loop_tmin = loop_time - loop_tmin - if (loop_tmin > loop_tmax) - loop_tmax = loop_tmin - loop_fmax = loop_fmax - loop_freq - loop_fmin = loop_time - loop_fmin - if (loop_fmin > loop_fmax) - loop_fmax = loop_fmin - printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, rms %.3f\n", loop_count, loop_time * 1e6, loop_tmax * 1e6, loop_time_rms * 1e6, loop_freq, loop_fmax, loop_freq_rms + printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, var %.3f\n", loop_count, (loop_tmax + loop_tmin) / 2 * 1e6, (loop_tmax - loop_tmin) / 2 * 1e6, loop_time_rms * 1e6, (loop_fmax + loop_fmin) / 2, (loop_fmax - loop_fmin) / 2, loop_freq_rms } } diff --git a/contrib/xntpd/scripts/stats/psummary.awk b/contrib/xntpd/scripts/stats/psummary.awk index b7f0e922a7d6..5ef8d8eb5280 100644 --- a/contrib/xntpd/scripts/stats/psummary.awk +++ b/contrib/xntpd/scripts/stats/psummary.awk @@ -1,5 +1,7 @@ # program to scan peer_summary file and produce summary of daily summaries # +# usage: awk -f psummary.awk peer_summary +# { if (NF < 8 || $1 == "ident") continue diff --git a/contrib/xntpd/scripts/stats/rms.awk b/contrib/xntpd/scripts/stats/rms.awk new file mode 100644 index 000000000000..34d612ab3582 --- /dev/null +++ b/contrib/xntpd/scripts/stats/rms.awk @@ -0,0 +1,41 @@ +# program to scan peer_summary file +# +{ + if (NF < 8 || $1 == "ident") + continue + i = n + for (j = 0; j < n; j++) { + if ($1 == peer_ident[j]) + i = j + } + if (i == n) { + peer_ident[i] = $1 + n++ + } + peer_count[i]++ + if (($7 - $6 / 2) < 400) { + peer_count[i]++ + peer_mean[i] += $3 + peer_var[i] += $4 * $4 + if ($5 > peer_max[i]) + peer_max[i] = $5 + if ($5 > 1) + peer_1[i]++ + if ($5 > 5) + peer_2[i]++ + if ($5 > 10) + peer_3[i]++ + if ($5 > 50) + peer_4[i]++ + } +} END { + printf " host cnt mean sd max >1 >5 >10 >50\n" + printf "=================================================================\n" + for (i = 0; i < n; i++) { + if (peer_count[i] <= 0) + continue + peer_mean[i] /= peer_count[i] + peer_var[i] = sqrt(peer_var[i] / peer_count[i]) + printf "%15s%4d%10.3f%10.3f%10.3f%4d%4d%4d%4d\n", peer_ident[i], peer_count[i], peer_mean[i], peer_var[i], peer_max[i], peer_1[i], peer_2[i], peer_3[i], peer_4[i] + } +} diff --git a/contrib/xntpd/scripts/stats/summary.sh b/contrib/xntpd/scripts/stats/summary.sh index ab99f4d8e8d5..caac2b0c3bec 100755 --- a/contrib/xntpd/scripts/stats/summary.sh +++ b/contrib/xntpd/scripts/stats/summary.sh @@ -1,17 +1,88 @@ -#!/bin/csh +#!/bin/sh # # Script to summarize ipeerstats, loopstats and clockstats files # # This script can be run from a cron job once per day, week or month. It # runs the file-specific summary script and appends the summary data to -# designated files, which must be created first. +# designated files. # -if ( -e peer_summary ) then - peer.sh >>peer_summary -endif -if ( -e loop_summary ) then - loop.sh >>loop_summary -endif -if ( -e clock_summary ) then - clock.sh >>clock_summary -endif +DATE=`date +19%y%m%d` +SIN=S.in +SOUT=S.out +LOOP=loop_summary +PEER=peer_summary +CLOCK=clock_summary + +rm -f $SIN $SOUT +S=0 +if [ -f `which S | cut -f1 -d" "` ]; then + S=1 +fi +# +# Summarize loopstats files +# +for f in loopstats.????????; do + d=`echo $f | cut -f2 -d.` + if [ $DATE != $d ]; then + echo " " >>$LOOP + echo $f >>$LOOP + awk -f loop.awk $f >>$LOOP + if [ $S ]; then + echo "file1<-"\"${f}\" >>$SIN + echo "source("\""loop.S"\"")" >>$SIN + fi + rm -f $f + fi +done + +# +# Summarize peerstats files +# +for f in peerstats.????????; do + d=`echo $f | cut -f2 -d.` + if [ $DATE != $d ]; then + echo " " >>$PEER + echo $f >>$PEER + awk -f peer.awk $f >>$PEER + rm -f $f + fi +done + +# +# Summarize clockstats files +# +for f in clockstats.????????; do + d=`echo $f | cut -f2 -d.` + if [ $DATE != $d ]; then + echo " " >>$CLOCK + echo $f >>$CLOCK + awk -f clock.awk $f >>$CLOCK + if [ -f /dev/gps* ]; then + awk -f itf.awk $f >itf.$d + awk -f etf.awk $f >etf.$d + awk -f ensemble.awk $f >ensemble.$d + awk -f tdata.awk $f >tdata.$d + fi + rm -f $f + fi +done + +# +# Process clockstat files with S and generate PostScript plots +# +for f in itf etf ensemble tdata; do + for d in ${f}.????????; do + if [ -f $d ]; then + if [ $S ]; then + echo "file1<-"\"${d}\" >>$SIN + echo "source("\"${f}.S\"")" >>$SIN + echo "unix("\""rm ${d}"\"")" >>$SIN + else + rm -f $d + fi + fi + done +done +if [ -f $SIN ]; then + S BATCH $SIN $SOUT +fi diff --git a/contrib/xntpd/scripts/stats/tdata.S b/contrib/xntpd/scripts/stats/tdata.S new file mode 100644 index 000000000000..f360a248c06a --- /dev/null +++ b/contrib/xntpd/scripts/stats/tdata.S @@ -0,0 +1,5 @@ +tdata <- scan(file1, list(day=0, sec=0, m=0, w=0, x=0, y=0, z=0)) +str <- paste("eps/", file1, ".eps", sep="") +postscript(str, , , , 5, pointsize=18) +par(mgp=c(1, 0, 0), tck=0.03, mar=c(2, 2, 1, 1)) +plot(tdata$sec, tdata$m, type="l", xlab=paste("MJD", tdata$day, "Time (s)"), ylab="LORAN-M SNR (dB)") diff --git a/contrib/xntpd/scripts/support/bin/monl b/contrib/xntpd/scripts/support/bin/monl index 44201d0d0f99..f0c48dbf5f3f 100755 --- a/contrib/xntpd/scripts/support/bin/monl +++ b/contrib/xntpd/scripts/support/bin/monl @@ -143,7 +143,8 @@ foreach $hostname (@ARGV) { chop; split; - ($host, $count, $mode, $version, $lasttime, $firsttime) = (@_[$[, $[+2 .. $[+6]); + ($host, $count, $mode, $version, $lasttime, $firsttime) = + (@_[$[, $[+2 .. $[+4, $#_-1,$#_]); $Seen{$host, $mode} = 1; diff --git a/contrib/xntpd/util/ntptime.c b/contrib/xntpd/util/ntptime.c index c0512df90a87..858fe7cba481 100644 --- a/contrib/xntpd/util/ntptime.c +++ b/contrib/xntpd/util/ntptime.c @@ -15,27 +15,29 @@ #include #include -#include - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" #ifndef SYS_DECOSF1 #define BADCALL -1 /* this is supposed to be a bad syscall */ -#endif +#endif /* SYS_DECOSF1 */ + +#ifdef KERNEL_PLL +#include +#define ntp_gettime(t) syscall(SYS_ntp_gettime, (t)) +#define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) +#else /* KERNEL_PLL */ #include "ntp_timex.h" - -#ifdef KERNEL_PLL -#ifndef SYS_ntp_adjtime #define SYS_ntp_adjtime NTP_SYSCALL_ADJ -#endif -#ifndef SYS_ntp_gettime #define SYS_ntp_gettime NTP_SYSCALL_GET -#endif -#endif /* KERNEL_PLL */ +#endif /* KERNEL_PLL */ +/* + * Function prototypes + */ extern int sigvec P((int, struct sigvec *, struct sigvec *)); +extern int syscall P((int, void *, ...)); void pll_trap P((void)); static struct sigvec newsigsys; /* new sigvec status */ @@ -56,50 +58,50 @@ main(argc, argv) struct ntptimeval ntv; struct timex ntx, _ntx; int times[20]; - double ftemp; + double ftemp, gtemp; l_fp ts; int c; int errflg = 0; int cost = 0; int rawtime = 0; - ntx.mode = 0; + memset((char *)&ntx, 0, sizeof(ntx)); progname = argv[0]; while ((c = ntp_getopt(argc, argv, optargs)) != EOF) switch (c) { case 'c': cost++; break; case 'e': - ntx.mode |= ADJ_ESTERROR; + ntx.modes |= MOD_ESTERROR; ntx.esterror = atoi(ntp_optarg); break; case 'f': - ntx.mode |= ADJ_FREQUENCY; - ntx.frequency = (int) (atof(ntp_optarg) - * (1 << SHIFT_USEC)); - if (ntx.frequency < (-100 << SHIFT_USEC) - || ntx.frequency > ( 100 << SHIFT_USEC)) errflg++; + ntx.modes |= MOD_FREQUENCY; + ntx.freq = (int) (atof(ntp_optarg) * + (1 << SHIFT_USEC)); + if (ntx.freq < (-100 << SHIFT_USEC) + || ntx.freq > ( 100 << SHIFT_USEC)) errflg++; break; case 'm': - ntx.mode |= ADJ_MAXERROR; + ntx.modes |= MOD_MAXERROR; ntx.maxerror = atoi(ntp_optarg); break; case 'o': - ntx.mode |= ADJ_OFFSET; + ntx.modes |= MOD_OFFSET; ntx.offset = atoi(ntp_optarg); break; case 'r': rawtime++; break; case 's': - ntx.mode |= ADJ_STATUS; + ntx.modes |= MOD_STATUS; ntx.status = atoi(ntp_optarg); if (ntx.status < 0 || ntx.status > 4) errflg++; break; case 't': - ntx.mode |= ADJ_TIMECONST; - ntx.time_constant = atoi(ntp_optarg); - if (ntx.time_constant < 0 || ntx.time_constant > MAXTC) + ntx.modes |= MOD_TIMECONST; + ntx.constant = atoi(ntp_optarg); + if (ntx.constant < 0 || ntx.constant > MAXTC) errflg++; break; default: @@ -115,7 +117,7 @@ main(argc, argv) -m maxerror max possible error (us)\n\ -o offset current offset (ms)\n\ -r print the unix and NTP time raw\n\ - -s status Set the status (0 .. 4)\n\ + -l leap Set the leap bits\n\ -t timeconstant log2 of PLL time constant (0 .. %d)\n", progname, optargs, MAXTC); exit(2); @@ -151,13 +153,13 @@ main(argc, argv) times[c] = ntv.time.tv_usec; } if (pll_control >= 0) { - printf("[ usec %06d:", times[0]); + printf("[ us %06d:", times[0]); for (c=1; c< sizeof times / sizeof times[0]; c++) printf(" %d", times[c] - times[c-1]); printf(" ]\n"); } } (void)ntp_gettime(&ntv); - ntx.mode = 0; /* Ensure nothing is set */ + _ntx.modes = 0; /* Ensure nothing is set */ (void)ntp_adjtime(&_ntx); if (pll_control < 0) { printf("NTP user interface routines are not configured in this kernel.\n"); @@ -175,9 +177,9 @@ main(argc, argv) ts.l_uf += TS_ROUNDBIT; /* guaranteed not to overflow */ ts.l_ui += JAN_1970; ts.l_uf &= TS_MASK; - printf(" time: %s, (.%06d)\n", + printf(" time %s, (.%06d),\n", prettydate(&ts), ntv.time.tv_usec); - printf(" confidence interval: %ld usec, estimated error: %ld usec\n", + printf(" maximum error %ld us, estimated error %ld us.\n", ntv.maxerror, ntv.esterror); if (rawtime) printf(" ntptime=%x.%x unixtime=%x.%06d %s", ts.l_ui, ts.l_uf, @@ -189,15 +191,26 @@ main(argc, argv) ">> ntp_adjtime() call fails"); else { printf("ntp_adjtime() returns code %d\n", status); - ftemp = ntx.frequency; + ftemp = ntx.freq; ftemp /= (1 << SHIFT_USEC); - printf(" mode: %02x, offset: %ld usec, frequency: %6.3f ppm,\n", - ntx.mode, ntx.offset, ftemp); - printf(" confidence interval: %ld usec, estimated error: %ld usec,\n", + printf(" modes %04x, offset %ld us, frequency %.3f ppm, interval %d s,\n", + ntx.modes, ntx.offset, ftemp, 1 << ntx.shift); + printf(" maximum error %ld us, estimated error %ld us,\n", ntx.maxerror, ntx.esterror); - printf(" status: %d, time constant: %ld, precision: %ld usec, tolerance: %ld usec\n", - ntx.status, ntx.time_constant, ntx.precision, - ntx.tolerance); + ftemp = ntx.tolerance; + ftemp /= (1 << SHIFT_USEC); + printf(" status %04x, time constant %ld, precision %ld us, tolerance %.0f ppm,\n", + ntx.status, ntx.constant, ntx.precision, ftemp); + if (ntx.shift == 0) + return; + ftemp = ntx.ppsfreq; + ftemp /= (1 << SHIFT_USEC); + gtemp = ntx.stabil; + gtemp /= (1 << SHIFT_USEC); + printf(" pps frequency %.3f ppm, stability %.3f ppm, jitter %ld us,\n", + ftemp, gtemp, ntx.jitter); + printf(" intervals %ld, jitter exceeded %ld, stability exceeded %ld, errors %ld.\n", + ntx.calcnt, ntx.jitcnt, ntx.stbcnt, ntx.errcnt); } /* diff --git a/contrib/xntpd/util/tickadj.c b/contrib/xntpd/util/tickadj.c index ab10b3728a0e..caec06871795 100644 --- a/contrib/xntpd/util/tickadj.c +++ b/contrib/xntpd/util/tickadj.c @@ -1,4 +1,4 @@ -/* tickadj.c,v 3.1 1993/07/06 01:11:05 jbj Exp +/* * tickadj - read, and possibly modify, the kernel `tick' and * `tickadj' variables, as well as `dosynctodr'. Note that * this operates on the running kernel only. I'd like to be @@ -6,6 +6,41 @@ * mastered this yet. */ #include + +#ifdef SYS_LINUX +#include + +struct timex txc; + +int +main(int argc, char ** argv) +{ + if (argc > 2) + { + fprintf(stderr, "Usage: %s [tick_value]\n", argv[0]); + exit(-1); + } + else if (argc == 2) + { + if ( (txc.tick = atoi(argv[1])) < 1 ) + { + fprintf(stderr, "Silly value for tick: %s\n", argv[1]); + exit(-1); + } + txc.mode = ADJ_TICK; + } + else + txc.mode = 0; + + if (__adjtimex(&txc) < 0) + perror("adjtimex"); + else + printf("tick = %d\n", txc.tick); + + return(0); +} +#else /* not Linux... kmem tweaking: */ + #include #include #include @@ -298,10 +333,13 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) #if defined(SYS_AUX3) || defined(SYS_AUX2) #define X_TICKADJ 0 -#define X_V 1 -#define X_TICK 2 +#define X_TICK 1 #define X_DEF - static struct nlist nl[4]; + static struct nlist nl[] = + { {"tickadj"}, + {"tick"}, + {""}, + }; #endif #ifdef NeXT @@ -353,6 +391,22 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) #endif #endif +#if defined(SYS_HPUX) +#define X_TICKADJ 0 +#define X_TICK 1 +#define X_DEF + static struct nlist nl[] = +#ifdef hp9000s300 + { {"_tickadj"}, + {"_old_tick"}, +#else + { {"tickadj"}, + {"old_tick"}, +#endif + {""}, + }; +#endif + #if !defined(X_DEF) #define X_TICKADJ 0 #define X_TICK 1 @@ -373,17 +427,11 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) "/kernel/unix", "/386bsd", "/netbsd", + "/hp-ux", NULL }; struct stat stbuf; -#if defined(SYS_AUX3) || defined(SYS_AUX2) - strcpy (nl[X_TICKADJ].n_name, "tickadj"); - strcpy (nl[X_V].n_name, "v"); - strcpy (nl[X_TICK].n_name, "tick"); - nl[3].n_name[0] = '\0'; -#endif - for (kname = kernels; *kname != NULL; kname++) { if (stat(*kname, &stbuf) == -1) continue; @@ -513,3 +561,4 @@ readvar(fd, off, var) exit(1); } } +#endif /* not Linux */ diff --git a/contrib/xntpd/xntpd/Makefile b/contrib/xntpd/xntpd/Makefile index 56f5dc2eb6eb..a4b083efde72 100644 --- a/contrib/xntpd/xntpd/Makefile +++ b/contrib/xntpd/xntpd/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.4 1994/02/03 23:23:17 wollman Exp $ +# $Id: Makefile,v 1.5 1994/04/03 20:37:26 wollman Exp $ # CFLAGS+= -I${.CURDIR}/../include @@ -34,7 +34,7 @@ SRCS= ntp_config.c ntp_control.c ntp_io.c ntp_leap.c \ refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ refclock_parse.c refclock_as2201.c refclock_omega.c \ refclock_tpro.c refclock_leitch.c refclock_irig.c \ - refclock_msfees.c refclock_gpstm.c ntp_intres.c \ + refclock_msfees.c refclock_gpstm.c refclock_trak.c ntp_intres.c \ ntp_filegen.c version.c beforedepend: version.c diff --git a/contrib/xntpd/adjtime/.keep_me b/contrib/xntpd/xntpd/minpoll similarity index 100% rename from contrib/xntpd/adjtime/.keep_me rename to contrib/xntpd/xntpd/minpoll diff --git a/contrib/xntpd/xntpd/ntp_config.c b/contrib/xntpd/xntpd/ntp_config.c index 1b716f69fab5..8f356ac8c2e7 100644 --- a/contrib/xntpd/xntpd/ntp_config.c +++ b/contrib/xntpd/xntpd/ntp_config.c @@ -45,8 +45,9 @@ * peer 128.100.1.1 [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] * server 128.100.2.2 [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] * precision -7 - * broadcast 128.100.224.255 [ version 3 ] [ key 0 ] - * broadcastclient yes|no + * broadcast 128.100.224.255 [ version 3 ] [ key 0 ] [ ttl 1 ] + * broadcastclient + * multicastclient [224.0.1.1] * broadcastdelay 0.0102 * authenticate yes|no * monitor yes|no @@ -58,6 +59,16 @@ * statsdir /var/NTP/ * filegen peerstats [ file peerstats ] [ type day ] [ link ] * resolver /path/progname + * clientlimit [ n ] + * clientperiod [ 3600 ] + * trustedkey [ key ] + * requestkey [ key] + * controlkey [ key ] + * trap [ address ] + * fudge [ ... ] + * pidfile [ ] + * logfile [ ] + * setvar [ ] * * And then some. See the manual page. */ @@ -84,22 +95,24 @@ #define CONFIG_CONTROLKEY 15 #define CONFIG_TRAP 16 #define CONFIG_FUDGE 17 -#define CONFIG_MAXSKEW 18 -#define CONFIG_RESOLVER 19 -#define CONFIG_SELECT 20 -#define CONFIG_STATSDIR 21 -#define CONFIG_FILEGEN 22 -#define CONFIG_STATISTICS 23 -#define CONFIG_PPS 24 -#define CONFIG_PIDFILE 25 -#define CONFIG_LOGFILE 26 -#define CONFIG_SETVAR 27 +#define CONFIG_RESOLVER 18 +#define CONFIG_STATSDIR 19 +#define CONFIG_FILEGEN 20 +#define CONFIG_STATISTICS 21 +#define CONFIG_PPS 22 +#define CONFIG_PIDFILE 23 +#define CONFIG_LOGFILE 24 +#define CONFIG_SETVAR 25 +#define CONFIG_CLIENTLIMIT 26 +#define CONFIG_CLIENTPERIOD 27 +#define CONFIG_MULTICASTCLIENT 28 #define CONF_MOD_VERSION 1 #define CONF_MOD_KEY 2 #define CONF_MOD_MINPOLL 3 #define CONF_MOD_MAXPOLL 4 #define CONF_MOD_PREFER 5 +#define CONF_MOD_TTL 6 #define CONF_PPS_DELAY 1 #define CONF_PPS_BAUD 2 @@ -114,6 +127,7 @@ #define CONF_RES_NOTRAP 8 #define CONF_RES_LPTRAP 9 #define CONF_RES_NTPPORT 10 +#define CONF_RES_LIMITED 11 #define CONF_TRAP_PORT 1 #define CONF_TRAP_INTERFACE 2 @@ -158,6 +172,7 @@ static struct keyword keywords[] = { { "driftfile", CONFIG_DRIFTFILE }, { "broadcast", CONFIG_BROADCAST }, { "broadcastclient", CONFIG_BROADCASTCLIENT }, + { "multicastclient", CONFIG_MULTICASTCLIENT }, { "authenticate", CONFIG_AUTHENTICATE }, { "keys", CONFIG_KEYS }, { "monitor", CONFIG_MONITOR }, @@ -170,15 +185,15 @@ static struct keyword keywords[] = { { "controlkey", CONFIG_CONTROLKEY }, { "trap", CONFIG_TRAP }, { "fudge", CONFIG_FUDGE }, - { "maxskew", CONFIG_MAXSKEW }, { "resolver", CONFIG_RESOLVER }, - { "select", CONFIG_SELECT }, { "statsdir", CONFIG_STATSDIR }, { "filegen", CONFIG_FILEGEN }, { "statistics", CONFIG_STATISTICS }, { "pidfile", CONFIG_PIDFILE }, { "logfile", CONFIG_LOGFILE }, { "setvar", CONFIG_SETVAR }, + { "clientlimit", CONFIG_CLIENTLIMIT }, + { "clientperiod", CONFIG_CLIENTPERIOD }, { "", CONFIG_UNKNOWN } }; @@ -191,6 +206,7 @@ static struct keyword mod_keywords[] = { { "minpoll", CONF_MOD_MINPOLL }, { "maxpoll", CONF_MOD_MAXPOLL }, { "prefer", CONF_MOD_PREFER }, + { "ttl", CONF_MOD_TTL }, { "", CONFIG_UNKNOWN } }; @@ -217,6 +233,7 @@ static struct keyword res_keywords[] = { { "notrap", CONF_RES_NOTRAP }, { "lowpriotrap", CONF_RES_LPTRAP }, { "ntpport", CONF_RES_NTPPORT }, + { "limited", CONF_RES_LIMITED }, { "", CONFIG_UNKNOWN } }; @@ -318,12 +335,12 @@ extern int debug; #endif extern char *FindConfig(); char *progname; -static char *xntp_options = "abc:de:f:k:l:p:r:s:t:v:V:"; +static char *xntp_options = "abc:de:f:k:l:mp:r:s:t:v:V:"; static int gettokens P((FILE *, char *, char **, int *)); static int matchkey P((char *, struct keyword *)); static int getnetnum P((char *, struct sockaddr_in *, int)); -static void save_resolve P((char *, int, int, int, int, int, U_LONG)); +static void save_resolve P((char *, int, int, int, int, int, int, U_LONG)); static void do_resolve P((char *, U_LONG, char *)); #ifdef RESOLVE_INTERNAL static void do_resolve_internal P((void)); @@ -410,6 +427,7 @@ getconfig(argc, argv) int peerversion; int minpoll; int maxpoll; + int ttl; U_LONG peerkey; int peerflags; int hmode; @@ -466,12 +484,15 @@ getconfig(argc, argv) case 'a': proto_config(PROTO_AUTHENTICATE, (LONG)1); break; + case 'b': proto_config(PROTO_BROADCLIENT, (LONG)1); break; + case 'c': config_file = ntp_optarg; break; + case 'd': #ifdef DEBUG debug++; @@ -516,6 +537,10 @@ getconfig(argc, argv) } break; + case 'm': + proto_config(PROTO_MULTICAST_ADD, INADDR_NTP); + break; + case 'p': stats_config(STATS_PID_FILE, ntp_optarg); break; @@ -624,6 +649,7 @@ getconfig(argc, argv) maxpoll = NTP_MAXPOLL; peerkey = 0; peerflags = 0; + ttl = 1; for (i = 2; i < ntokens; i++) switch (matchkey(tokens[i], mod_keywords)) { case CONF_MOD_VERSION: @@ -689,6 +715,16 @@ getconfig(argc, argv) peerflags |= FLAG_PREFER; break; + case CONF_MOD_TTL: + if (i >= ntokens-1) { + syslog(LOG_ERR, + "ttl: argument required"); + errflg = 1; + break; + } + ttl = atoi(tokens[++i]); + break; + case CONFIG_UNKNOWN: errflg = 1; break; @@ -700,14 +736,15 @@ getconfig(argc, argv) if (errflg == 0) { if (peer_config(&peeraddr, (struct interface *)0, hmode, peerversion, - minpoll, maxpoll, peerkey, peerflags) == 0) { + minpoll, maxpoll, peerflags, ttl, peerkey) + == 0) { syslog(LOG_ERR, "configuration of %s failed", ntoa(&peeraddr)); } } else if (errflg == -1) { save_resolve(tokens[1], hmode, peerversion, - minpoll, maxpoll, peerflags, peerkey); + minpoll, maxpoll, peerflags, ttl, peerkey); } break; @@ -764,23 +801,20 @@ getconfig(argc, argv) } break; case CONFIG_BROADCASTCLIENT: - errflg = 0; - if (ntokens >= 2) { - if (STREQ(tokens[1], "yes")) - proto_config(PROTO_BROADCLIENT, (LONG)1); - else if (STREQ(tokens[1], "no")) - proto_config(PROTO_BROADCLIENT, (LONG)0); - else - errflg++; - } else { - errflg++; - } - - if (errflg) - syslog(LOG_ERR, - "should be `broadcastclient yes|no'"); + proto_config(PROTO_BROADCLIENT, (U_LONG)1); break; + case CONFIG_MULTICASTCLIENT: + if (ntokens > 1) { + for (i = 1; i < ntokens; i++) { + if (getnetnum(tokens[i], &peeraddr, 1)); + proto_config(PROTO_MULTICAST_ADD, + peeraddr.sin_addr.s_addr); + } + } else + proto_config(PROTO_MULTICAST_ADD, INADDR_NTP); + break; + case CONFIG_AUTHENTICATE: errflg = 0; if (ntokens >= 2) { @@ -817,9 +851,9 @@ getconfig(argc, argv) errflg = 0; if (ntokens >= 2) { if (STREQ(tokens[1], "yes")) - mon_start(); + mon_start(MON_ON); else if (STREQ(tokens[1], "no")) - mon_stop(); + mon_stop(MON_ON); else errflg++; } else { @@ -965,6 +999,10 @@ getconfig(argc, argv) peerkey |= RESM_NTPONLY; break; + case CONF_RES_LIMITED: + peerversion |= RES_LIMITED; + break; + case CONFIG_UNKNOWN: errflg++; break; @@ -1252,26 +1290,6 @@ getconfig(argc, argv) #endif break; - case CONFIG_MAXSKEW: - if (ntokens >= 2) { - l_fp tmp; - u_fp utmp; - - if (!atolfp(tokens[1], &tmp)) { - syslog(LOG_ERR, - "maxskew value %s undecodable", - tokens[1]); - } else if (tmp.l_ui != 0) { - syslog(LOG_ERR, - "maxskew value %s is unlikely", - tokens[1]); - } else { - utmp = LFPTOFP(&tmp); - proto_config(PROTO_MAXSKEW, (LONG)utmp); - } - } - break; - case CONFIG_RESOLVER: if (ntokens >= 2) { if (strlen(tokens[1]) >= (size_t)MAXFILENAME) { @@ -1288,18 +1306,6 @@ getconfig(argc, argv) } break; - case CONFIG_SELECT: - if (ntokens >= 2) { - i = atoi(tokens[1]); - if (i < SELECT_1 || i > SELECT_5) - syslog(LOG_ERR, - "invalid selection algorithm %s, line ignored", - tokens[1]); - else - proto_config(PROTO_SELECT, (LONG)i); - } - break; - case CONFIG_STATSDIR: if (ntokens >= 2) { stats_config(STATS_STATSDIR,tokens[1]); @@ -1414,6 +1420,60 @@ getconfig(argc, argv) ((((ntokens > 2) && !strcmp(tokens[2], "default"))) ? DEF : 0)); } break; + + case CONFIG_CLIENTLIMIT: + if (ntokens < 2) + { + syslog(LOG_ERR, + "no value for clientlimit command - line ignored"); + } + else + { + U_LONG i; + if (!atouint(tokens[1], &i) || !i) + { + syslog(LOG_ERR, + "illegal value for clientlimit command - line ignored"); + } + else + { + extern U_LONG client_limit; + char bp[80]; + + sprintf(bp, "client_limit=%d", i); + set_sys_var(bp, strlen(bp)+1, RO); + + client_limit = i; + } + } + break; + + case CONFIG_CLIENTPERIOD: + if (ntokens < 2) + { + syslog(LOG_ERR, + "no value for clientperiod command - line ignored"); + } + else + { + U_LONG i; + if (!atouint(tokens[1], &i) || i < 64) + { + syslog(LOG_ERR, + "illegal value for clientperiod command - line ignored"); + } + else + { + extern U_LONG client_limit_period; + char bp[80]; + + sprintf(bp, "client_limit_period=%d", i); + set_sys_var(bp, strlen(bp)+1, RO); + + client_limit_period = i; + } + } + break; } } (void) fclose(fp); @@ -1643,13 +1703,14 @@ int sig; * save_resolve - save configuration info into a file for later name resolution */ static void -save_resolve(name, mode, version, minpoll, maxpoll, flags, keyid) +save_resolve(name, mode, version, minpoll, maxpoll, flags, ttl, keyid) char *name; int mode; int version; int minpoll; int maxpoll; int flags; + int ttl; U_LONG keyid; { if (res_fp == NULL) { @@ -1668,8 +1729,8 @@ save_resolve(name, mode, version, minpoll, maxpoll, flags, keyid) } #endif - (void) fprintf(res_fp, "%s %d %d %d %d %d %lu\n", name, mode, - version, minpoll, maxpoll, flags, keyid); + (void) fprintf(res_fp, "%s %d %d %d %d %d %d %lu\n", name, mode, + version, minpoll, maxpoll, flags, ttl, keyid); } diff --git a/contrib/xntpd/xntpd/ntp_control.c b/contrib/xntpd/xntpd/ntp_control.c index 1c7849f48820..ef9c37a6751d 100644 --- a/contrib/xntpd/xntpd/ntp_control.c +++ b/contrib/xntpd/xntpd/ntp_control.c @@ -264,8 +264,20 @@ static u_char def_clock_var[] = { /* * System and processor definitions. These will change for the gizmo board. */ +#ifndef HAVE_UNAME +#ifndef STR_SYSTEM +#define STR_SYSTEM "UNIX" +#endif +#ifndef STR_PROCESSOR +#define STR_PROCESSOR "unknown" +#endif + +static char str_system[] = STR_SYSTEM; +static char str_processor[] = STR_PROCESSOR; +#else #include static struct utsname utsname; +#endif /* HAVE_UNAME */ /* * Trap structures. We only allow a few of these, and send @@ -294,7 +306,7 @@ static struct utsname utsname; static u_char clocktypes[] = { CTL_SST_TS_NTP, /* REFCLK_NONE */ CTL_SST_TS_UNSPEC, /* REFCLK_LOCALCLOCK */ - CTL_SST_TS_HF, /* REFCLK_WWV_HEATH */ + CTL_SST_TS_UHF, /* REFCLK_GPS_TRAK */ CTL_SST_TS_HF, /* REFCLK_WWV_PST */ CTL_SST_TS_LF, /* REFCLK_WWVB_SPECTRACOM */ CTL_SST_TS_UHF, /* REFCLK_GOES_TRUETIME */ @@ -379,6 +391,7 @@ extern struct peer *sys_peer; extern l_fp last_offset; extern s_fp drift_comp; extern int time_constant; +extern int pll_control; /* * Imported from the leap module */ @@ -426,7 +439,9 @@ init_control() { int i; +#ifdef HAVE_UNAME uname(&utsname); +#endif /* HAVE_UNAME */ ctl_clr_stats(); @@ -716,10 +731,12 @@ ctlsysstatus() if (sys_peer != 0) if (sys_peer->sstclktype != CTL_SST_TS_UNSPEC) clock = sys_peer->sstclktype; - else + else { if (sys_peer->refclktype < sizeof(clocktypes)) clock = clocktypes[sys_peer->refclktype]; - + if (pps_control) + clock |= CTL_SST_TS_PPS; + } return (u_short)CTL_SYS_STATUS(sys_leap, clock, ctl_sys_num_events, ctl_sys_last_event); } @@ -1262,12 +1279,22 @@ ctl_putsys(varid) ctl_putuint(sys_var[CS_LEAPWARNING].text, (U_LONG)leap_warning); break; case CS_PROCESSOR: +#ifndef HAVE_UNAME + ctl_putstr(sys_var[CS_PROCESSOR].text, str_processor, + sizeof(str_processor) - 1); +#else ctl_putstr(sys_var[CS_PROCESSOR].text, utsname.machine, strlen(utsname.machine)); +#endif /* HAVE_UNAME */ break; case CS_SYSTEM: - ctl_putstr(sys_var[CS_SYSTEM].text, utsname.sysname, +#ifndef HAVE_UNAME + ctl_putstr(sys_var[CS_SYSTEM].text, str_system, + sizeof(str_system) - 1); +#else + ctl_putstr(sys_var[CS_SYSTEM].text, utsname.sysname, strlen(utsname.sysname)); +#endif /* HAVE_UNAME */ break; case CS_KEYID: ctl_putuint(sys_var[CS_KEYID].text, (U_LONG)0); diff --git a/contrib/xntpd/xntpd/ntp_intres.c b/contrib/xntpd/xntpd/ntp_intres.c index 20561e91b82d..5ff4af4d8242 100644 --- a/contrib/xntpd/xntpd/ntp_intres.c +++ b/contrib/xntpd/xntpd/ntp_intres.c @@ -48,6 +48,7 @@ struct conf_entry { #define ce_minpoll ce_config.minpoll #define ce_maxpoll ce_config.maxpoll #define ce_flags ce_config.flags +#define ce_ttl ce_config.ttl #define ce_keyid ce_config.keyid /* @@ -102,8 +103,9 @@ static int resolve_value; /* next value of resolve timer */ #define TOK_MINPOLL 3 #define TOK_MAXPOLL 4 #define TOK_FLAGS 5 -#define TOK_KEYID 6 -#define NUMTOK 7 +#define TOK_TTL 6 +#define TOK_KEYID 7 +#define NUMTOK 8 #define MAXLINESIZE 512 @@ -128,7 +130,7 @@ extern int errno; static RETSIGTYPE bong P((int)); static void checkparent P((void)); static void removeentry P((struct conf_entry *)); -static void addentry P((char *, int, int, int, int, int, U_LONG)); +static void addentry P((char *, int, int, int, int, int, int, U_LONG)); static int findhostaddr P((struct conf_entry *)); static void openntp P((void)); static int request P((struct conf_peer *)); @@ -279,13 +281,14 @@ removeentry(entry) * addentry - add an entry to the configuration list */ static void -addentry(name, mode, version, minpoll, maxpoll, flags, keyid) +addentry(name, mode, version, minpoll, maxpoll, flags, ttl, keyid) char *name; int mode; int version; int minpoll; int maxpoll; int flags; + int ttl; U_LONG keyid; { register char *cp; @@ -304,6 +307,7 @@ addentry(name, mode, version, minpoll, maxpoll, flags, keyid) ce->ce_minpoll = (u_char)minpoll; ce->ce_maxpoll = (u_char)maxpoll; ce->ce_flags = (u_char)flags; + ce->ce_ttl = (u_char)ttl; ce->ce_keyid = htonl(keyid); ce->ce_next = NULL; @@ -751,7 +755,8 @@ readconf(fp, name) */ addentry(token[TOK_HOSTNAME], (int)intval[TOK_HMODE], (int)intval[TOK_VERSION], (int)intval[TOK_MINPOLL], - (int)intval[TOK_MAXPOLL], flags, intval[TOK_KEYID]); + (int)intval[TOK_MAXPOLL], flags, (int)intval[TOK_TTL], + intval[TOK_KEYID]); } } diff --git a/contrib/xntpd/xntpd/ntp_io.c b/contrib/xntpd/xntpd/ntp_io.c index 614d5c52bde9..551df510dc37 100644 --- a/contrib/xntpd/xntpd/ntp_io.c +++ b/contrib/xntpd/xntpd/ntp_io.c @@ -10,6 +10,10 @@ #include #include +#ifdef MCAST +#include "ntp_in.h" +#endif /* MCAST */ + #include "ntpd.h" #include "ntp_select.h" #include "ntp_io.h" @@ -53,7 +57,6 @@ /* * Block the interrupt, for critical sections. */ - #if defined(HAVE_SIGNALED_IO) #define BLOCKIO() ((void) block_sigio()) #define UNBLOCKIO() ((void) unblock_sigio()) @@ -228,6 +231,9 @@ create_sockets(port) inter_list[0].sent = 0; inter_list[0].notsent = 0; inter_list[0].flags = INT_BROADCAST; +#ifdef MCAST + inter_list[0].flags |= INT_MULTICAST; +#endif /* MCAST */ #ifdef USE_STREAMS_DEVICE_FOR_IF_CONFIG if ((vs = open("/dev/ip", O_RDONLY)) < 0) { @@ -394,7 +400,7 @@ create_sockets(port) maxactivefd = 0; FD_ZERO(&activefds); - + for (i = 0; i < ninterfaces; i++) { inter_list[i].fd = open_socket(&inter_list[i].sin, inter_list[i].flags & INT_BROADCAST); @@ -458,23 +464,72 @@ io_setbclient() } +#ifdef MCAST +/* + * io_multicast_add() - add multicast group address + */ +void +io_multicast_add(addr) + U_LONG addr; +{ + int fd = inter_list[0].fd; + struct ip_mreq mreq; + + if (!IN_CLASSD(addr)) + return; + /* + * enable reception of multicast packets + */ + mreq.imr_multiaddr.s_addr = addr; + mreq.imr_interface.s_addr = INADDR_ANY; + if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (char *)&mreq, sizeof(mreq)) == -1) + syslog(LOG_ERR, "setsockopt IP_ADD_MEMBERSHIP fails: %m"); +} +#endif /* MCAST */ + + /* * io_unsetbclient - close the broadcast client sockets */ void io_unsetbclient() { - int i; + int i; for (i = 1; i < ninterfaces; i++) { if (!(inter_list[i].flags & INT_BCASTOPEN)) continue; close_socket(inter_list[i].bfd); inter_list[i].flags &= ~INT_BCASTOPEN; - } + } } +#ifdef MCAST +/* + * io_multicast_del() - delete multicast group address + */ +void +io_multicast_del(addr) + U_LONG addr; +{ + int fd = inter_list[0].fd; + struct ip_mreq mreq; + + if (!IN_CLASSD(addr)) + return; + /* + * disable reception of multicast packets + */ + mreq.imr_multiaddr.s_addr = addr; + mreq.imr_interface.s_addr = INADDR_ANY; + if (setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, + (char *)&mreq, sizeof(mreq)) == -1) + syslog(LOG_ERR, "setsockopt IP_DROP_MEMBERSHIP fails: %m"); +} +#endif /* MCAST */ + /* * open_socket - open a socket, returning the file descriptor @@ -510,7 +565,8 @@ open_socket(addr, bcast) */ if (bind(fd, (struct sockaddr *)addr, sizeof(*addr)) < 0) { char buff[160]; - sprintf(buff, "bind() fd %d, family %d, port %d, addr %08x, bcast=%d fails: %%m", + sprintf(buff, + "bind() fd %d, family %d, port %d, addr %08x, bcast=%d fails: %%m", fd, addr->sin_family, addr->sin_port, @@ -557,6 +613,19 @@ Need non blocking I/O syslog(LOG_ERR, "setsockopt SO_REUSEADDR off fails: %m"); } +#ifdef MCAST + /* for the moment we use the bcast option to set multicast ttl */ + + if (bcast) { + unsigned char mttl = 127; + + /* set the multicast ttl for outgoing packets */ + if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, + &mttl, sizeof(mttl)) == -1) { + syslog(LOG_ERR, "setsockopt IP_MULTICAST_TTL fails: %m"); + } + } +#endif /* MCAST */ #ifdef SO_BROADCAST /* if this interface can support broadcast, set SO_BROADCAST */ @@ -566,7 +635,7 @@ Need non blocking I/O syslog(LOG_ERR, "setsockopt(SO_BROADCAST): %m"); } } -#endif +#endif /* SO_BROADCAST */ #ifdef DEBUG if (debug > 1) @@ -608,7 +677,7 @@ struct interface * findbcastinter(addr) struct sockaddr_in *addr; { -#ifdef SIOCGIFCONF +#ifdef SIOCGIFCONF register int i; register U_LONG netnum; @@ -622,7 +691,7 @@ findbcastinter(addr) == (netnum & NSRCADR(&inter_list[i].mask))) return &inter_list[i]; } -#endif +#endif /* SIOCGIFCONF */ return any_interface; } @@ -744,7 +813,7 @@ sendpkt(dest, inter, pkt, len) #ifdef DEBUG if (debug) - printf("sendpkt(%s, %s, %d)\n", ntoa(dest), + printf("sendpkt(fd=%d %s, %s, %d)\n", inter->fd, ntoa(dest), ntoa(&inter->sin), len); #endif @@ -902,11 +971,16 @@ again: } if (FD_ISSET(fd, &fds)) { n--; + /* * Get a buffer and read the frame. If we * haven't got a buffer, or this is received * on the wild card socket, just dump the packet. */ + + if (!(free_recvbufs && i == 0 && + inter_list[i].flags & INT_MULTICAST)) { + #ifdef UDP_WILDCARD_DELIVERY /* * these guys manage to put properly addressed packets into the wildcard queue @@ -932,6 +1006,7 @@ again: packets_dropped++; continue; } + } rb = freelist; freelist = rb->next; @@ -958,7 +1033,7 @@ again: if (debug) printf("input_handler: fd=%d length %d\n", fd, rb->recv_length); #endif - + /* * Got one. Mark how and when it got here, * put it on the full list and do bookkeeping. diff --git a/contrib/xntpd/xntpd/ntp_loopfilter.c b/contrib/xntpd/xntpd/ntp_loopfilter.c index 6d79c5d52ff4..13cbd61b6741 100644 --- a/contrib/xntpd/xntpd/ntp_loopfilter.c +++ b/contrib/xntpd/xntpd/ntp_loopfilter.c @@ -9,9 +9,6 @@ #include "ntpd.h" #include "ntp_io.h" -#if defined(KERNEL_PLL) -#include "ntp_timex.h" -#endif /* KERNEL_PLL */ #include "ntp_unixtime.h" #if defined(PPS) || defined(PPSCLK) || defined(PPSPPS) @@ -46,11 +43,13 @@ #include "ntp_stdlib.h" -#ifdef KERNEL_PLL -#ifndef SYS_ntp_adjtime -#define SYS_ntp_adjtime NTP_SYSCALL_ADJ +#ifdef KERNEL_PLL +#include +#ifndef NTP_SYSCALLS_LIBC +#define ntp_gettime(t) syscall(SYS_ntp_gettime, (t)) +#define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) #endif -#endif /* KERNEL_PLL */ +#endif /* KERNEL_PLL */ /* * The loop filter is implemented in slavish adherence to the @@ -95,17 +94,14 @@ #define RSH_DRIFT_TO_FRAC (CLOCK_DSCALE - 16) #define RSH_DRIFT_TO_ADJ (RSH_DRIFT_TO_FRAC - CLOCK_ADJ) #define RSH_FRAC_TO_FREQ (CLOCK_FREQ + CLOCK_ADJ - RSH_DRIFT_TO_FRAC) +#define PPS_MAXAGE 120 /* pps signal timeout (s) */ +#define PPS_MAXUPDATE 600 /* pps update timeout (s) */ /* - * Imported from the ntp_proto module + * Program variables */ -extern u_char sys_stratum; -extern s_fp sys_rootdelay; -extern u_fp sys_rootdispersion; -extern s_char sys_precision; - l_fp last_offset; /* last adjustment done */ -static LONG clock_adjust; /* clock adjust register (fraction only) */ +static LONG clock_adjust; /* clock adjust (fraction only) */ s_fp drift_comp; /* drift compensation register */ static s_fp max_comp; /* drift limit imposed by max host clock slew */ @@ -114,11 +110,15 @@ static s_fp max_comp; /* drift limit imposed by max host clock slew */ static U_LONG tcadj_time; /* last time-constant adjust time */ U_LONG watchdog_timer; /* watchdog timer, in seconds */ -static int first_adjustment; /* set to 1 if waiting for first adjustment */ +static int first_adjustment; /* 1 if waiting for first adjustment */ static int tc_counter; /* time-constant hold counter */ - int pll_control; /* set nonzero if pll implemented in kernel */ - int pps_control; /* set nonzero if pps signal valid */ +static l_fp pps_offset; /* filtered pps offset */ +static u_fp pps_dispersion; /* pps dispersion */ +static U_LONG pps_time; /* last pps sample time */ + + int pps_control; /* true if working pps signal */ + int pll_control; /* true if working kernel pll */ static l_fp pps_delay; /* pps tuning offset */ U_LONG pps_update; /* last pps update time */ int fdpps = -1; /* pps file descriptor */ @@ -154,29 +154,35 @@ static l_fp pps_delay; /* pps tuning offset */ ( i == 300 ? B300 : 0 )))))))) #define PPS_BAUD B38400 /* default serial port speed */ -#define PPS_MAXAGE 120 /* seconds after which we disbelieve pps */ -#define PPS_MAXUPDATE 600 /* seconds after which we disbelieve timecode */ +timecode */ #define PPS_DEV "/dev/pps" /* pps port */ #define PPS_FAC 3 /* pps shift (log2 trimmed samples) */ -#define NPPS 12 /* pps filter size (1< 1) - printf("local_clock(%s, %s)\n", lfptoa(fp_offset, 9), + printf("local_clock(%s, %s)\n", lfptoa(fp_offset, 6), ntoa(&peer->srcadr)); #endif @@ -432,33 +450,26 @@ local_clock(fp_offset, peer) last_offset = *fp_offset; /* - * If the magnitude of the offset is greater than CLOCK.MAX, step - * the time and reset the registers. + * If the magnitude of the offset is greater than CLOCK.MAX, + * step the time and reset the registers. */ if (tmp_ui > CLOCK_MAX_I || (tmp_ui == CLOCK_MAX_I && (U_LONG)tmp_uf >= (U_LONG)CLOCK_MAX_F)) { if (watchdog_timer < CLOCK_MINSTEP) { /* Mustn't step yet, pretend we adjusted. */ -#ifdef SLEWALWAYS syslog(LOG_INFO, - "adjust: SLEW dropped (%s offset %s)\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); -#else - syslog(LOG_INFO, - "adjust: STEP dropped (%s offset %s)\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); -#endif + "clock correction %s too large (ignored)\n", + lfptoa(fp_offset, 6)); return (0); } + syslog(LOG_NOTICE, "clock reset (%s) %s\n", #ifdef SLEWALWAYS - syslog(LOG_NOTICE, " ** adjust: SLEW %s offset %s **\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); + "slew", #else - syslog(LOG_NOTICE, " ** adjust: STEP %s offset %s **\n", - ntoa(&peer->srcadr), lfptoa(fp_offset, 9)); + "step", #endif + lfptoa(fp_offset, 6)); step_systime(fp_offset); - clock_adjust = 0; watchdog_timer = 0; first_adjustment = 1; @@ -480,20 +491,24 @@ local_clock(fp_offset, peer) * The time constant update goes after adjust and skew updates, * as in appendix G. */ -#if defined(PPS) || defined(PPSCLK) || defined(PPSPPS) /* * If pps samples are valid, update offset, root delay and - * root dispersion. This may be a dramatic surprise to high- - * stratum clients, since all of a sudden this server looks - * like a stratum-1 clock. + * root dispersion. Also, set the system stratum to 1, even if + * the source of approximate time runs at a higher stratum. This + * may be a dramatic surprise to high-stratum clients, since all + * of a sudden this server looks like a stratum-1 clock. */ if (pps_control) { last_offset = pps_offset; + sys_maxd = pps_dispersion; sys_stratum = 1; sys_rootdelay = 0; - sys_rootdispersion = sys_maxd; + offset = LFPTOFP(&pps_offset); + if (offset < 0) + offset = -offset; + sys_rootdispersion = offset + pps_dispersion; } -#endif /* PPS || PPSCLK || PPSPPS */ + offset = last_offset.l_f; /* * The pll_control is active when the phase-lock code is @@ -504,26 +519,56 @@ local_clock(fp_offset, peer) * know the scaling of the frequency variable (s_fp) is the * same as the kernel variable (1 << SHIFT_USEC = 16). * + * For kernels with the PPS discipline, the current offset and + * dispersion are set from kernel variables to maintain + * beauteous displays, but don't do much of anything. + * * In the case of stock kernels the phase-lock loop is * implemented the hard way and the clock_adjust and drift_comp * computed as required. */ - offset = last_offset.l_f; if (pll_control) { #if defined(KERNEL_PLL) - ntv.mode = ADJ_OFFSET | ADJ_TIMECONST | ADJ_MAXERROR | - ADJ_ESTERROR; + memset((char *)&ntv, 0, sizeof ntv); + ntv.modes = MOD_BITS; if (offset >= 0) { TSFTOTVU(offset, ntv.offset); } else { TSFTOTVU(-offset, ntv.offset); ntv.offset = -ntv.offset; } - ntv.maxerror = sys_rootdispersion + sys_rootdelay / 2; - ntv.esterror = sys_rootdispersion; - ntv.time_constant = time_constant; + TSFTOTVU(sys_rootdispersion + sys_rootdelay / 2, ntv.maxerror); + TSFTOTVU(sys_rootdispersion, ntv.esterror); + ntv.status = pll_status; + if (pps_update) + ntv.status |= STA_PPSTIME; + if (sys_leap & LEAP_ADDSECOND && + sys_leap & LEAP_DELSECOND) + ntv.status |= STA_UNSYNC; + else if (sys_leap & LEAP_ADDSECOND) + ntv.status |= STA_INS; + else if (sys_leap & LEAP_DELSECOND) + ntv.status |= STA_DEL; + ntv.constant = time_constant; (void)ntp_adjtime(&ntv); - drift_comp = ntv.frequency; + drift_comp = ntv.freq; + if (ntv.status & STA_PPSTIME && ntv.status & STA_PPSSIGNAL + && ntv.shift) { + if (ntv.offset >= 0) { + TVUTOTSF(ntv.offset, offset); + } else { + TVUTOTSF(-ntv.offset, offset); + offset = -offset; + } + pps_offset.l_i = pps_offset.l_f = 0; + M_ADDF(pps_offset.l_i, pps_offset.l_f, offset); + TVUTOTSF(ntv.jitter, tmp); + pps_dispersion = (tmp >> 16) & 0xffff; + pps_time = current_time; + record_peer_stats(&loopback_interface->sin, + ctlsysstatus(), &pps_offset, 0, pps_dispersion); + } else + pps_time = 0; #endif /* KERNEL_PLL */ } else { if (offset < 0) { @@ -533,21 +578,14 @@ local_clock(fp_offset, peer) } /* - * Calculate the new frequency error. The factor given in the - * spec gives the adjustment per 2**CLOCK_ADJ seconds, but we - * want it as a (scaled) pure ratio, so we include that factor - * now and remove it later. + * Calculate the new frequency error. The factor given + * in the spec gives the adjustment per 2**CLOCK_ADJ + * seconds, but we want it as a (scaled) pure ratio, so + * we include that factor now and remove it later. */ if (first_adjustment) { first_adjustment = 0; } else { - /* - * Clamp the integration interval to maxpoll. - * The bitcounting in Section 5 gives (n+1)-6 for 2**n, - * but has a factor 2**6 missing from CLOCK_FREQ. - * We make 2**n give n instead. If watchdog_timer is - * zero, pretend it's one. - */ tmp = peer->maxpoll; tmp_uf = watchdog_timer; if (tmp_uf == 0) @@ -558,10 +596,11 @@ local_clock(fp_offset, peer) } /* - * We apply the frequency scaling at the same time as - * the sample interval; this ensures a safe right-shift. - * (as long as it keeps below 31 bits, which current - * parameters should ensure. + * We apply the frequency scaling at the same + * time as the sample interval; this ensures a + * safe right-shift. (as long as it keeps below + * 31 bits, which current parameters should + * ensure. */ tmp = (RSH_FRAC_TO_FREQ - tmp) + time_constant + time_constant; @@ -581,7 +620,9 @@ local_clock(fp_offset, peer) /* * Determine when to adjust the time constant and poll interval. */ - if (current_time - tcadj_time >= (1 << sys_poll)) { + if (pps_control) + time_constant = 0; + else if (current_time - tcadj_time >= (1 << sys_poll) && !pps_control) { tcadj_time = current_time; tmp = offset; if (tmp < 0) @@ -607,8 +648,8 @@ local_clock(fp_offset, peer) #ifdef DEBUG if (debug > 1) printf("adj %s, drft %s, tau %3i\n", - mfptoa((clock_adjust<0?-1:0), clock_adjust, 9), - fptoa(drift_comp, 9), time_constant); + mfptoa((clock_adjust<0?-1:0), clock_adjust, 6), + fptoa(drift_comp, 6), time_constant); #endif /* DEBUG */ (void) record_loop_stats(&last_offset, &drift_comp, time_constant); @@ -662,20 +703,20 @@ adj_host_clock() } } #endif /* PPSPPS */ - if (pps_time != 0 && current_time - pps_time > PPS_MAXAGE) - pps_time = 0; - if (pps_update != 0 && current_time - pps_update > PPS_MAXUPDATE) - pps_update = 0; - if (pps_time != 0 && pps_update != 0) { +#endif /* PPS || PPSCLK || PPSPPS */ + if (pps_time && current_time - pps_time > PPS_MAXAGE) + pps_time = 0; + if (pps_update && current_time - pps_update > PPS_MAXUPDATE) + pps_update = 0; + if (pps_time && pps_update) { if (!pps_control) - syslog(LOG_INFO, "pps synch"); + syslog(LOG_INFO, "PPS synch"); pps_control = 1; } else { if (pps_control) - syslog(LOG_INFO, "pps synch lost"); + syslog(LOG_INFO, "PPS synch lost"); pps_control = 0; } -#endif /* PPS || PPSCLK || PPSPPS */ /* * Resist the following code if the phase-lock loop has been @@ -722,22 +763,27 @@ loop_config(item, lfp_value, int_value) tmp = LFPTOFP(lfp_value); if (tmp >= max_comp || tmp <= -max_comp) { syslog(LOG_ERR, - "loop_config: skew compensation %s too large", + "loop_config: frequency offset %s in ntp.conf file is too large", fptoa(tmp, 5)); } else { drift_comp = tmp; #if defined(KERNEL_PLL) /* - * If the phase-lock code is implemented in the kernel, - * give the time_constant and saved frequency offset - * to the kernel. If not, no harm is done. + * If the phase-lock code is implemented in the + * kernel, give the time_constant and saved + * frequency offset to the kernel. If not, no + * harm is done. */ pll_control = 1; - ntv.mode = ADJ_FREQUENCY | ADJ_STATUS | ADJ_TIMECONST; - ntv.status = TIME_BAD; - ntv.time_constant = time_constant; - ntv.frequency = drift_comp; + pll_status = STA_PLL | STA_PPSFREQ; + ntv.modes = MOD_BITS | MOD_FREQUENCY; + ntv.offset = 0; + ntv.freq = drift_comp; + ntv.maxerror = NTP_MAXDISPERSE; + ntv.esterror = NTP_MAXDISPERSE; + ntv.status = pll_status | STA_UNSYNC; + ntv.constant = time_constant; newsigsys.sv_handler = pll_trap; newsigsys.sv_mask = 0; newsigsys.sv_flags = 0; @@ -748,13 +794,13 @@ loop_config(item, lfp_value, int_value) if ((sigvec(SIGSYS, &sigsys, (struct sigvec *)NULL))) syslog(LOG_ERR, "sigvec() fails to restore SIGSYS trap: %m\n"); - syslog(LOG_NOTICE, - "%susing kernel phase-lock loop", - (pll_control) ? "" : "Not "); -#if DEBUG - if (debug) - printf("pll_control %d\n", pll_control); -#endif + if (pll_control) + syslog(LOG_NOTICE, + "using kernel phase-lock loop %04x", + ntv.status); + else + syslog(LOG_NOTICE, + "using xntpd phase-lock loop"); #endif /* KERNEL_PLL */ } @@ -812,7 +858,7 @@ loop_config(item, lfp_value, int_value) * _trap - trap processor for undefined syscalls * * This nugget is called by the kernel when the SYS_ntp_adjtime() - * syscall bombs because the silly thing has not been implemented int + * syscall bombs because the silly thing has not been implemented in * the kernel. In this case the phase-lock loop is emulated by * the stock adjtime() syscall and a lot of indelicate abuse. */ @@ -873,12 +919,14 @@ int pps_sample(tsr) int i, j; /* temp ints */ LONG sort[NPPS]; /* temp array for sorting */ l_fp lftemp, ts; /* l_fp temps */ + u_fp utemp; /* u_fp temp */ LONG ltemp; /* long temp */ /* * Note the seconds offset is already in the low-order timestamp - * doubleword, so all we have to do is sign-extend and invert it. - * The resulting offset is believed only if within CLOCK_MAX. + * doubleword, so all we have to do is sign-extend and invert + * it. The resulting offset is believed only if within + * CLOCK_MAX. */ ts = *tsr; lftemp.l_i = lftemp.l_f = 0; @@ -934,14 +982,14 @@ int pps_sample(tsr) } lftemp.l_i = 0; lftemp.l_f = sort[NPPS-1-PPS_TRIM] - sort[PPS_TRIM]; - sys_maxd = LFPTOFP(&lftemp); + pps_dispersion = LFPTOFP(&lftemp); #ifdef DEBUG if (debug) printf("pps_filter: %s %s %s\n", lfptoa(&pps_delay, 6), lfptoa(&pps_offset, 6), lfptoa(&lftemp, 5)); #endif /* DEBUG */ - record_peer_stats(&loopback_interface->sin, ctlsysstatus(), &pps_offset, - sys_rootdelay, sys_rootdispersion); + record_peer_stats(&loopback_interface->sin, ctlsysstatus(), + &pps_offset, 0, pps_dispersion); return (0); } #endif /* PPS || PPSCLK || PPSPPS */ diff --git a/contrib/xntpd/xntpd/ntp_monitor.c b/contrib/xntpd/xntpd/ntp_monitor.c index 63af8d4d4d97..e2d2eb51adac 100644 --- a/contrib/xntpd/xntpd/ntp_monitor.c +++ b/contrib/xntpd/xntpd/ntp_monitor.c @@ -58,7 +58,7 @@ static struct mon_data *mon_hash; /* Pointer to array of hash buckets */ static int *mon_hash_count; /* Point to hash count stats keeper */ struct mon_data mon_mru_list; - + struct mon_data mon_fifo_list; /* * List of free structures structures, and counters of free and total * structures. The free structures are linked with the hash_next field. @@ -93,7 +93,7 @@ init_mon() * Don't do much of anything here. We don't allocate memory * until someone explicitly starts us. */ - mon_enabled = 0; + mon_enabled = MON_OFF; mon_have_memory = 0; mon_free_mem = 0; @@ -103,6 +103,7 @@ init_mon() mon_hash = 0; mon_hash_count = 0; memset((char *)&mon_mru_list, 0, sizeof mon_mru_list); + memset((char *)&mon_fifo_list, 0, sizeof mon_fifo_list); } @@ -110,13 +111,18 @@ init_mon() * mon_start - start up the monitoring software */ void -mon_start() +mon_start(mode) + int mode; { register struct mon_data *md; register int i; - if (mon_enabled) + if (mon_enabled != MON_OFF) { + mon_enabled |= mode; return; + } + if (mode == MON_OFF) + return; /* Ooops.. */ if (!mon_have_memory) { mon_hash = (struct mon_data *) @@ -142,7 +148,10 @@ mon_start() mon_mru_list.mru_next = &mon_mru_list; mon_mru_list.mru_prev = &mon_mru_list; - mon_enabled = 1; + mon_fifo_list.fifo_next = &mon_fifo_list; + mon_fifo_list.fifo_prev = &mon_fifo_list; + + mon_enabled = mode; } @@ -150,12 +159,19 @@ mon_start() * mon_stop - stop the monitoring software */ void -mon_stop() +mon_stop(mode) + int mode; { register struct mon_data *md; register int i; - if (!mon_enabled) + if (mon_enabled == MON_OFF) + return; + if ((mon_enabled & mode) == 0 || mode == MON_OFF) + return; + + mon_enabled &= ~mode; + if (mon_enabled != MON_OFF) return; /* @@ -176,7 +192,8 @@ mon_stop() mon_mru_list.mru_next = &mon_mru_list; mon_mru_list.mru_prev = &mon_mru_list; - mon_enabled = 0; + mon_fifo_list.fifo_next = &mon_fifo_list; + mon_fifo_list.fifo_prev = &mon_fifo_list; } @@ -194,7 +211,7 @@ monitor(rbufp) register int mode; register struct mon_data *mdhash; - if (!mon_enabled) + if (mon_enabled == MON_OFF) return; pkt = &rbufp->recv_pkt; @@ -220,6 +237,7 @@ monitor(rbufp) md->mru_prev = &mon_mru_list; mon_mru_list.mru_next->mru_prev = md; mon_mru_list.mru_next = md; + return; } md = md->hash_next; @@ -240,6 +258,12 @@ monitor(rbufp) md->hash_next->hash_prev = md->hash_prev; md->hash_prev->hash_next = md->hash_next; *(mon_hash_count + MON_HASH(md->rmtadr)) -= 1; + /* + * Get it from FIFO list + */ + md->fifo_prev->fifo_next = md->fifo_next; + md->fifo_next->fifo_prev = md->fifo_prev; + } else { if (mon_free_mem == 0) mon_getmoremem(); @@ -252,6 +276,7 @@ monitor(rbufp) * Got one, initialize it */ md->lasttime = md->firsttime = current_time; + md->lastdrop = 0; md->count = 1; md->rmtadr = netnum; md->rmtport = NSRCPORT(&rbufp->recv_srcadr); @@ -260,7 +285,8 @@ monitor(rbufp) /* * Shuffle him into the hash table, inserting him at the - * end. Also put him on top of the MRU list. + * end. Also put him on top of the MRU list + * and at bottom of FIFO list */ mdhash = mon_hash + MON_HASH(netnum); md->hash_next = mdhash; @@ -273,6 +299,11 @@ monitor(rbufp) md->mru_prev = &mon_mru_list; mon_mru_list.mru_next->mru_prev = md; mon_mru_list.mru_next = md; + + md->fifo_prev = mon_fifo_list.fifo_prev; + md->fifo_next = &mon_fifo_list; + mon_fifo_list.fifo_prev->fifo_next = md; + mon_fifo_list.fifo_prev = md; } diff --git a/contrib/xntpd/xntpd/ntp_peer.c b/contrib/xntpd/xntpd/ntp_peer.c index cadd415346a9..9d8ec35dee78 100644 --- a/contrib/xntpd/xntpd/ntp_peer.c +++ b/contrib/xntpd/xntpd/ntp_peer.c @@ -340,22 +340,24 @@ unpeer(peer_to_remove) * peer_config - configure a new peer */ struct peer * -peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) +peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, flags, ttl, key) struct sockaddr_in *srcadr; struct interface *dstadr; int hmode; int version; int minpoll; int maxpoll; - U_LONG key; int flags; + int ttl; + U_LONG key; { register struct peer *peer; #ifdef DEBUG if (debug) - printf("peer_config: addr %s mode %d version %d minpoll %d maxpoll %d key %u\n", - ntoa(srcadr), hmode, version, minpoll, maxpoll, key); + printf("peer_config: addr %s mode %d version %d minpoll %d maxpoll %d flags %d ttl %d key %u\n", + ntoa(srcadr), hmode, version, minpoll, maxpoll, flags, + ttl, key); #endif /* * See if we have this guy in the tables already. If @@ -387,6 +389,7 @@ peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) peer->ppoll = peer->minpoll; peer->flags = ((u_char)(flags|FLAG_CONFIG)) |(peer->flags & (FLAG_REFCLOCK|FLAG_DEFBDELAY)); + peer->ttl = (u_char)ttl; peer->keyid = key; return peer; } @@ -395,7 +398,8 @@ peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) * If we're here this guy is unknown to us. Make a new peer * structure for him. */ - peer = newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, key); + peer = newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, + ttl, key); if (peer != 0) peer->flags |= (u_char)(flags|FLAG_CONFIG); return peer; @@ -406,13 +410,14 @@ peer_config(srcadr, dstadr, hmode, version, minpoll, maxpoll, key, flags) * newpeer - initialize a new peer association */ struct peer * -newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, key) +newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, ttl, key) struct sockaddr_in *srcadr; struct interface *dstadr; int hmode; int version; int minpoll; int maxpoll; + int ttl; U_LONG key; { register struct peer *peer; @@ -454,13 +459,10 @@ newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, key) peer->maxpoll = (u_char)maxpoll; peer->hpoll = peer->minpoll; peer->ppoll = peer->minpoll; + peer->ttl = ttl; peer->keyid = key; - - if (hmode == MODE_BCLIENT) { - peer->estbdelay = sys_bdelay; - peer->flags |= FLAG_DEFBDELAY; - } - + peer->estbdelay = sys_bdelay; + peer->flags |= FLAG_DEFBDELAY; peer->leap = LEAP_NOTINSYNC; peer->precision = DEFPRECISION; peer->dispersion = NTP_MAXDISPERSE; diff --git a/contrib/xntpd/xntpd/ntp_proto.c b/contrib/xntpd/xntpd/ntp_proto.c index 88e95bbf8d13..a3f744eae881 100644 --- a/contrib/xntpd/xntpd/ntp_proto.c +++ b/contrib/xntpd/xntpd/ntp_proto.c @@ -25,7 +25,7 @@ l_fp sys_reftime; /* time we were last updated */ l_fp sys_refskew; /* accumulated skew since last update */ struct peer *sys_peer; /* our current peer */ u_char sys_poll; /* log2 of desired system poll interval */ -LONG sys_clock; /* second part of current time */ +extern LONG sys_clock; /* second part of current time - now in systime.c */ LONG sys_lastselect; /* sys_clock at last synch-dist update */ /* @@ -48,7 +48,7 @@ U_LONG sys_unknownversion; /* don't know version packets */ U_LONG sys_badlength; /* packets with bad length */ U_LONG sys_processed; /* packets processed */ U_LONG sys_badauth; /* packets dropped because of authorization */ -U_LONG sys_wanderhold; /* sys_peer held to prevent wandering */ +U_LONG sys_limitrejected; /* pkts rejected due toclient count per net */ /* * Imported from ntp_timer.c @@ -90,7 +90,8 @@ transmit(peer) struct pkt xpkt; /* packet to send */ U_LONG peer_timer; - if (peer->hmode != MODE_BCLIENT) { + if ((peer->hmode != MODE_BROADCAST && peer->hmode != MODE_BCLIENT) || + (peer->hmode == MODE_BROADCAST && sys_leap != LEAP_NOTINSYNC)) { U_LONG xkeyid; /* @@ -239,17 +240,14 @@ transmit(peer) /* * Finally, adjust the hpoll variable for special conditions. */ - if (peer->flags & FLAG_SYSPEER && peer->hpoll > sys_poll) { - /* clamp it */ + if (peer->hmode == MODE_BCLIENT) + peer->hpoll = peer->ppoll; + else if (peer->flags & FLAG_SYSPEER && + peer->hpoll > sys_poll) peer->hpoll = max(peer->minpoll, sys_poll); - } - if (peer->hmode == MODE_BROADCAST || peer->hmode == MODE_BCLIENT) { - /* clamp it */ - peer->hpoll = peer->minpoll; - } /* - * Arrange for our next time out. hpoll will be less than + * Arrange for our next timeout. hpoll will be less than * maxpoll for sure. */ if (peer->event_timer.next != 0) @@ -262,37 +260,6 @@ transmit(peer) TIMER_ENQUEUE(timerqueue, &peer->event_timer); } -#if 0 -static void -ct_die(after) -{ - syslog(LOG_ERR, "timers garbled (%s)", after?"after":"before"); - abort(); -} - -void -check_timers(after) -{ - register int i; - register struct event *p, *q; - - for (i = 0; i < TIMER_NSLOTS; i++) { - p = &timerqueue[i]; - if (p->event_time != 0) - ct_die(after); - do { - q = p; - if ((p = p->next) == 0) - ct_die(after); - if (p->prev != q) - ct_die(after); - } while (p->event_time != 0); - if (p != &timerqueue[i]) - ct_die(after); - } -} -#endif - /* * receive - Receive Procedure. See section 3.4.2 in the specification. */ @@ -372,6 +339,21 @@ receive(rbufp) if (restrict & RES_DONTSERVE) return; + /* + * See if we only accept limited number of clients + * from the net this guy is from. + * Note: the flag is determined dynamically within restrictions() + */ + if (restrict & RES_LIMITED) { + extern U_LONG client_limit; + + sys_limitrejected++; + syslog(LOG_NOTICE, + "rejected mode %d request from %s - per net client limit (%d) exceeded", + PKT_MODE(pkt->li_vn_mode), + ntoa(&rbufp->recv_srcadr), client_limit); + return; + } /* * Dump anything with a putrid stratum. These will most likely * come from someone trying to poll us with ntpdc. @@ -517,6 +499,9 @@ receive(rbufp) break; case MODE_PASSIVE: +#ifdef MCAST + /* process the packet to determine the rt-delay */ +#endif /* MCAST */ case MODE_SERVER: /* * These are obvious errors. Ignore. @@ -534,8 +519,10 @@ receive(rbufp) /* * Sort of a repeat of the above... */ +/* if ((restrict & RES_NOPEER) || !sys_bclient) return; +*/ mymode = MODE_BCLIENT; break; } @@ -546,7 +533,7 @@ receive(rbufp) */ peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr, mymode, PKT_VERSION(pkt->li_vn_mode), NTP_MINDPOLL, - NTP_MAXPOLL, hiskeyid); + NTP_MAXPOLL, 0, hiskeyid); if (peer == 0) { /* * The only way this can happen is if the @@ -706,12 +693,11 @@ receive(rbufp) * out to be bad. */ peer2 = newpeer(&rbufp->recv_srcadr, - rbufp->dstadr, MODE_PASSIVE, - PKT_VERSION(pkt->li_vn_mode), - NTP_MINDPOLL, NTP_MAXPOLL, - hiskeyid); + rbufp->dstadr, MODE_PASSIVE, + PKT_VERSION(pkt->li_vn_mode), + NTP_MINDPOLL, NTP_MAXPOLL, 0, hiskeyid); if (process_packet(peer2, pkt, &rbufp->recv_time, - has_mac, trustable) == 0) { + has_mac, trustable) == 0) { /* * Strange situation. We've been receiving * broadcasts from him which we liked, but @@ -769,20 +755,21 @@ process_packet(peer, pkt, recv_ts, has_mac, trustable) sys_processed++; peer->processed++; - - peer->rec = *recv_ts; p_dist = NTOHS_FP(pkt->rootdelay); p_disp = NTOHS_FP(pkt->rootdispersion); NTOHL_FP(&pkt->rec, &p_rec); NTOHL_FP(&pkt->xmt, &p_xmt); - NTOHL_FP(&pkt->org, &p_org); + if (PKT_MODE(pkt->li_vn_mode) != MODE_BROADCAST) + NTOHL_FP(&pkt->org, &p_org); + else + p_org = peer->rec; + peer->rec = *recv_ts; peer->flash = 0; randomize = POLL_RANDOMCHANGE; /* * Test for old or duplicate packets (tests 1 through 3). */ - if (L_ISHIS(&peer->org, &p_xmt)) /* count old packets */ peer->oldpkt++; if (L_ISEQU(&peer->org, &p_xmt)) /* test 1 */ @@ -796,6 +783,9 @@ process_packet(peer, pkt, recv_ts, has_mac, trustable) if ((p_rec.l_ui == 0 && p_rec.l_uf == 0) || (p_org.l_ui == 0 && p_org.l_uf == 0)) peer->flash |= TEST3; /* unsynchronized */ + } else { + if (p_org.l_ui == 0 && p_org.l_uf == 0) + peer->flash |= TEST3; /* unsynchronized */ } peer->org = p_xmt; /* reuse byte-swapped pkt->xmt */ peer->ppoll = pkt->ppoll; @@ -901,39 +891,23 @@ process_packet(peer, pkt, recv_ts, has_mac, trustable) ci.l_ui = t10_ui; ci.l_uf = t10_uf; ei = (FP_SECOND >> (-(int)sys_precision)); - if (peer->hmode == MODE_BCLIENT) { -#ifdef notdef - if (PKT_MODE(pkt->li_vn_mode) == MODE_CLIENT) { - /* - * A client mode packet, used for delay computation. - * Give the data to the filter. - */ - bdelay_filter(peer, t23_ui, t23_uf, t10_ui, t10_uf); - } -#endif - M_ADDUF(ci.l_ui, ci.l_uf, peer->estbdelay>>1); + + /* + * If broadcast mode, time of last reception has been fiddled + * to p_org, rather than originate timestamp. We use this to + * augment dispersion and previously calcuated estbdelay as + * the delay. We know NTP_SKEWFACTOR == 16, which accounts for + * the simplified ei calculation. + */ + if (PKT_MODE(pkt->li_vn_mode) == MODE_BROADCAST) { + M_ADDUF(ci.l_ui, ci.l_uf, peer->estbdelay >> 1); di = MFPTOFP(0, peer->estbdelay); + ei += peer->rec.l_ui - p_org.l_ui; } else { M_ADD(ci.l_ui, ci.l_uf, t23_ui, t23_uf); M_RSHIFT(ci.l_i, ci.l_uf); - - /* - * Calculate di in t23 in full precision, then truncate - * to an s_fp. - */ M_SUB(t23_ui, t23_uf, t10_ui, t10_uf); di = MFPTOFP(t23_ui, t23_uf); - /* - * Calculate (t3 - t0) in t23 in full precision, convert - * to single, shift down by MAXSKEW and add to ei. - * We know NTP_SKEWFACTOR == 16 - */ -#if 0 - t23_ui = peer->rec.l_ui; /* peer->rec == t0 */ - t23_uf = peer->rec.l_uf; - M_SUB(t23_ui, t23_uf, p_org.l_ui, p_org.l_uf); /*pkt->org==t3*/ - ei += (MFPTOFP(t23_ui, t23_uf) >> NTP_SKEWFACTOR); -#endif ei += peer->rec.l_ui - p_org.l_ui; } #ifdef DEBUG @@ -1057,9 +1031,7 @@ clock_update(peer) if (d < 0) d = -d; sys_rootdelay = peer->rootdelay + d; - sys_maxd = peer->dispersion; - if (peer->flags & FLAG_PREFER) - sys_maxd += peer->selectdisp; + sys_maxd = peer->dispersion + peer->selectdisp; d = peer->soffset; if (d < 0) d = -d; @@ -1155,7 +1127,7 @@ poll_update(peer, new_hpoll, randomize) * Catch reference clocks here. The polling interval for a * reference clock is fixed and needn't be maintained by us. */ - if (peer->flags & FLAG_REFCLOCK) + if (peer->flags & FLAG_REFCLOCK || peer->hmode == MODE_BROADCAST) return; /* @@ -1177,7 +1149,9 @@ poll_update(peer, new_hpoll, randomize) * less that peer.timer, update peer.timer. */ oldpoll = peer->hpoll; - if ((peer->flags & FLAG_SYSPEER) && new_hpoll > sys_poll) + if (peer->hmode == MODE_BCLIENT) + peer->hpoll = peer->ppoll; + else if ((peer->flags & FLAG_SYSPEER) && new_hpoll > sys_poll) peer->hpoll = max(peer->minpoll, sys_poll); else { if (new_hpoll > peer->maxpoll) @@ -1192,10 +1166,10 @@ poll_update(peer, new_hpoll, randomize) newpoll = max((u_char)min(peer->ppoll, peer->hpoll), peer->minpoll); if (randomize == POLL_MAKERANDOM || (randomize == POLL_RANDOMCHANGE && newpoll != oldpoll)) - new_timer = (1<<(newpoll - 1)) + new_timer = (1 << (newpoll - 1)) + ranp2(newpoll - 1) + current_time; else - new_timer = (1<event_timer); if (evp->next == 0 || evp->event_time > new_timer) { TIMER_DEQUEUE(evp); @@ -1342,26 +1316,10 @@ clock_filter(peer, sample_offset, sample_delay, sample_error) /* * Find where he goes in, then shift everyone else down */ - if (peer->hmode == MODE_BCLIENT) { - register s_fp *soffsetp; - /* - * Sort by offset. The most positive offset - * should correspond to the minimum delay. - */ - soffsetp = peer->filter_soffset; - for (i = 0; i < NTP_SHIFT-1; i++) - if (errorp[ord[i]] >= NTP_MAXDISPERSE - || sample_soffset >= soffsetp[ord[i]]) - break; - } else { - /* - * Sort by distance. - */ - for (i = 0; i < NTP_SHIFT-1; i++) - if (errorp[ord[i]] >= NTP_MAXDISPERSE - || sample_distance <= distance[ord[i]]) - break; - } + for (i = 0; i < NTP_SHIFT-1; i++) + if (errorp[ord[i]] >= NTP_MAXDISPERSE + || sample_distance <= distance[ord[i]]) + break; for (j = NTP_SHIFT-1; j > i; j--) ord[j] = ord[j-1]; @@ -1676,7 +1634,7 @@ clock_select() if (d < 0) d = -d; sdisp += d; - sdisp = ((sdisp>>1) + sdisp) >> 1; + sdisp = ((sdisp >> 1) + sdisp) >> 1; } peer_list[i]->selectdisp = sdisp; if (sdisp > maxd) { @@ -1729,9 +1687,7 @@ clock_select() for (i = 1; i < nlist; i++) if (peer_list[i] == sys_peer) break; - if (i < nlist) - sys_wanderhold++; - else + if (i >= nlist) sys_peer = peer_list[0]; } @@ -2064,7 +2020,6 @@ init_proto() sys_unknownversion = 0; sys_processed = 0; sys_badauth = 0; - sys_wanderhold = 0; syslog(LOG_NOTICE, "default precision is initialized to 2**%d", sys_precision); } @@ -2076,7 +2031,7 @@ init_proto() void proto_config(item, value) int item; - LONG value; + U_LONG value; { /* * Figure out what he wants to change, then do it @@ -2087,11 +2042,33 @@ proto_config(item, value) * Turn on/off facility to listen to broadcasts */ sys_bclient = (int)value; - if (sys_bclient) + if (value) io_setbclient(); else io_unsetbclient(); break; + + case PROTO_MULTICAST_ADD: + /* + * Add multicast group address + */ + if (!sys_bclient) { + sys_bclient = 1; + io_setbclient(); + } +#ifdef MCAST + io_multicast_add(value); +#endif /* MCAST */ + break; + + case PROTO_MULTICAST_DEL: + /* + * Delete multicast group address + */ +#ifdef MCAST + io_multicast_del(value); +#endif /* MCAST */ + break; case PROTO_PRECISION: /* @@ -2104,7 +2081,7 @@ proto_config(item, value) /* * Set default broadcast delay */ - sys_bdelay = (((U_LONG)value) + 0x00000800) & 0xfffff000; + sys_bdelay = ((value) + 0x00000800) & 0xfffff000; break; case PROTO_AUTHENTICATE: @@ -2120,23 +2097,7 @@ proto_config(item, value) * Provide an authentication delay value. Round it to * the microsecond. This is crude. */ - sys_authdelay = (((U_LONG)value) + 0x00000800) & 0xfffff000; - break; - - case PROTO_MAXSKEW: - /* - * Set the maximum skew value - */ - syslog(LOG_ERR, - "proto_config: attempt to set maxskew (obsolete)"); - break; - - case PROTO_SELECT: - /* - * Set the selection algorithm. - */ - syslog(LOG_ERR, - "proto_config: attempt to set selection algorithm (obsolete)"); + sys_authdelay = ((value) + 0x00000800) & 0xfffff000; break; default: @@ -2163,6 +2124,6 @@ proto_clr_stats() sys_badlength = 0; sys_processed = 0; sys_badauth = 0; - sys_wanderhold = 0; sys_stattime = current_time; + sys_limitrejected = 0; } diff --git a/contrib/xntpd/xntpd/ntp_refclock.c b/contrib/xntpd/xntpd/ntp_refclock.c index 5199a1acbd26..2cb7cc29d9a4 100644 --- a/contrib/xntpd/xntpd/ntp_refclock.c +++ b/contrib/xntpd/xntpd/ntp_refclock.c @@ -93,17 +93,6 @@ refclock_newpeer(peer) peer->stratum = STRATUM_REFCLOCK; peer->ppoll = peer->minpoll; peer->hpoll = peer->minpoll; - peer->maxpoll = peer->minpoll; - - /* - * Check the flags. If the peer is configured in client mode - * but prefers the broadcast client filter algorithm, change - * him over. - */ - if (peer->hmode == MODE_CLIENT - && refclock_conf[clktype]->clock_flags & REF_FLAG_BCLIENT) - peer->hmode = MODE_BCLIENT; - peer->event_timer.peer = peer; peer->event_timer.event_handler = refclock_transmit; @@ -201,20 +190,14 @@ refclock_transmit(peer) l_fp off; - if (peer->valid > 0) peer->valid--; - if (peer->hpoll > peer->minpoll) peer->hpoll--; + if (peer->valid > 0) + peer->valid--; off.l_ui = off.l_uf = 0; clock_filter(peer, &off, 0, NTP_MAXDISPERSE); if (peer->flags & FLAG_SYSPEER) - clock_select(); - } else { - if (peer->valid < NTP_SHIFT) { - peer->valid++; - } else { - if (peer->hpoll < peer->maxpoll) - peer->hpoll++; - } - } + clock_select(); + } else if (peer->valid < NTP_SHIFT) + peer->valid++; /* * If he wants to be polled, do it. @@ -313,9 +296,6 @@ refclock_receive(peer, offset, delay, dispersion, reftime, rectime, leap) case MODE_CLIENT: peer->pmode = MODE_SERVER; break; - case MODE_BCLIENT: - peer->pmode = MODE_BROADCAST; - break; default: syslog(LOG_ERR, "refclock_receive: internal error, mode = %d", peer->hmode); diff --git a/contrib/xntpd/xntpd/ntp_request.c b/contrib/xntpd/xntpd/ntp_request.c index c19d1925a818..355b13b42b28 100644 --- a/contrib/xntpd/xntpd/ntp_request.c +++ b/contrib/xntpd/xntpd/ntp_request.c @@ -16,6 +16,14 @@ #include "ntp_if.h" #include "ntp_stdlib.h" +#ifdef KERNEL_PLL +#include +#ifndef NTP_SYSCALLS_LIBC +#define ntp_gettime(t) syscall(SYS_ntp_gettime, (t)) +#define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) +#endif +#endif /* KERNEL_PLL */ + /* * Structure to hold request procedure information */ @@ -56,7 +64,7 @@ static void do_conf P((struct sockaddr_in *, struct interface *, struct req_pkt static void do_unconf P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void set_sys_flag P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void clr_sys_flag P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void setclr_flags P((struct sockaddr_in *, struct interface *, struct req_pkt *, int)); +static void setclr_flags P((struct sockaddr_in *, struct interface *, struct req_pkt *, U_LONG)); static void do_monitor P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void do_nomonitor P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void list_restrict P((struct sockaddr_in *, struct interface *, struct req_pkt *)); @@ -83,13 +91,14 @@ static void set_request_keyid P((struct sockaddr_in *, struct interface *, struc static void set_control_keyid P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void get_ctl_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void get_leap_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +#ifdef KERNEL_PLL +static void get_kernel_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +#endif /* KERNEL_PLL */ #ifdef REFCLOCK static void get_clock_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void set_clock_fudge P((struct sockaddr_in *, struct interface *, struct req_pkt *)); #endif /* REFCLOCK */ -static void set_maxskew P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void set_precision P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void set_select_code P((struct sockaddr_in *, struct interface *, struct req_pkt *)); #ifdef REFCLOCK static void get_clkbug_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); #endif /* REFCLOCK */ @@ -134,9 +143,10 @@ static struct req_proc xntp_codes[] = { { REQ_CONTROL_KEY, AUTH, sizeof(U_LONG), set_control_keyid }, { REQ_GET_CTLSTATS, NOAUTH, 0, get_ctl_stats }, { REQ_GET_LEAPINFO, NOAUTH, 0, get_leap_info }, - { REQ_SET_MAXSKEW, AUTH, sizeof(u_fp), set_maxskew }, { REQ_SET_PRECISION, AUTH, sizeof(LONG), set_precision }, - { REQ_SET_SELECT_CODE, AUTH, sizeof(U_LONG), set_select_code }, +#ifdef KERNEL_PLL + { REQ_GET_KERNEL, NOAUTH, 0, get_kernel_info }, +#endif /* KERNEL_PLL */ #ifdef REFCLOCK { REQ_GET_CLOCKINFO, NOAUTH, sizeof(U_LONG), get_clock_info }, { REQ_SET_CLKFUDGE, AUTH, sizeof(struct conf_fudge), set_clock_fudge }, @@ -162,6 +172,10 @@ U_LONG numresppkts; /* number of resp packets sent with data */ U_LONG errorcounter[INFO_ERR_AUTH+1]; /* lazy way to count errors, indexed */ /* by the error code */ +#if defined(KERNEL_PLL) && !defined(NTP_SYSCALLS_LIBC) +extern int syscall P((int, void *, ...)); +#endif /* KERNEL_PLL */ + /* * Imported from the I/O module */ @@ -177,6 +191,11 @@ extern int debug; */ extern U_LONG current_time; +/* + * Imported from ntp_loopfilter.c + */ +extern int pll_control; + /* * A hack. To keep the authentication module clear of xntp-ism's, we * include a time reset variable for its stats here. @@ -657,6 +676,7 @@ peer_list_sum(srcadr, inter, inpkt) ips->delay = HTONS_FP(pp->delay); HTONL_FP(&pp->offset, &ips->offset); ips->dispersion = HTONS_FP(pp->dispersion); + pp = pp->next; ips = (struct info_peer_summary *)more_pkt(); } @@ -724,7 +744,9 @@ peer_info (srcadr, inter, inpkt) ip->valid = pp->valid; ip->reach = pp->reach; ip->unreach = pp->unreach; - ip->trust = 0; + ip->flash = pp->flash; + ip->estbdelay = htonl(pp->estbdelay); + ip->ttl = pp->ttl; ip->associd = htons(pp->associd); ip->rootdelay = HTONS_FP(pp->rootdelay); ip->rootdispersion = HTONS_FP(pp->rootdispersion); @@ -745,12 +767,10 @@ peer_info (srcadr, inter, inpkt) if (ip->order[i] >= NTP_SHIFT) ip->order[i] -= NTP_SHIFT; } - ip->delay = HTONS_FP(pp->delay); HTONL_FP(&pp->offset, &ip->offset); + ip->delay = HTONS_FP(pp->delay); ip->dispersion = HTONS_FP(pp->dispersion); - for (i = 0; i < NTP_SHIFT; i++) - ip->bdelay[i] = 0; - ip->estbdelay = htonl(pp->estbdelay); + ip->selectdisp = HTONS_FP(pp->selectdisp); ip = (struct info_peer *)more_pkt(); } flush_pkt(); @@ -882,12 +902,8 @@ sys_info(srcadr, inter, inpkt) is->flags |= INFO_FLAG_BCLIENT; if (sys_authenticate) is->flags |= INFO_FLAG_AUTHENABLE; - is->selection = 0; /* Obsolete */ - HTONL_UF(sys_bdelay, &is->bdelay); HTONL_UF(sys_authdelay, &is->authdelay); - is->maxskew = 0; - (void) more_pkt(); flush_pkt(); } @@ -915,7 +931,7 @@ sys_stats(srcadr, inter, inpkt) extern U_LONG sys_badlength; extern U_LONG sys_processed; extern U_LONG sys_badauth; - extern U_LONG sys_wanderhold; + extern U_LONG sys_limitrejected; ss = (struct info_sys_stats *)prepare_pkt(srcadr, inter, inpkt, sizeof(struct info_sys_stats)); @@ -929,8 +945,7 @@ sys_stats(srcadr, inter, inpkt) ss->badlength = htonl(sys_badlength); ss->processed = htonl(sys_processed); ss->badauth = htonl(sys_badauth); - ss->wanderhold = htonl(sys_wanderhold); - + ss->limitrejected = htonl(sys_limitrejected); (void) more_pkt(); flush_pkt(); } @@ -1167,7 +1182,7 @@ do_conf(srcadr, inter, inpkt) /* XXX W2DO? minpoll/maxpoll arguments ??? */ if (peer_config(&peeraddr, (struct interface *)0, cp->hmode, cp->version, cp->minpoll, cp->maxpoll, - cp->keyid, fl) == 0) { + fl, cp->ttl, cp->keyid) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } @@ -1252,7 +1267,7 @@ set_sys_flag(srcadr, inter, inpkt) struct interface *inter; struct req_pkt *inpkt; { - setclr_flags(srcadr, inter, inpkt, 1); + setclr_flags(srcadr, inter, inpkt, (U_LONG)1); } @@ -1265,7 +1280,7 @@ clr_sys_flag(srcadr, inter, inpkt) struct interface *inter; struct req_pkt *inpkt; { - setclr_flags(srcadr, inter, inpkt, 0); + setclr_flags(srcadr, inter, inpkt, (U_LONG)0); } @@ -1277,7 +1292,7 @@ setclr_flags(srcadr, inter, inpkt, set) struct sockaddr_in *srcadr; struct interface *inter; struct req_pkt *inpkt; - int set; + U_LONG set; { register U_LONG flags; @@ -1289,15 +1304,20 @@ setclr_flags(srcadr, inter, inpkt, set) flags = ((struct conf_sys_flags *)inpkt->data)->flags; if (flags - & ~(SYS_FLAG_BCLIENT|SYS_FLAG_AUTHENTICATE)) { + & ~(SYS_FLAG_BCLIENT | SYS_FLAG_MCLIENT | SYS_FLAG_AUTHENTICATE)) { req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } if (flags & SYS_FLAG_BCLIENT) - proto_config(PROTO_BROADCLIENT, (LONG)set); + proto_config(PROTO_BROADCLIENT, set); + if (flags & SYS_FLAG_MCLIENT) + if (set) + proto_config(PROTO_MULTICAST_ADD, INADDR_NTP); + else + proto_config(PROTO_MULTICAST_DEL, INADDR_NTP); if (flags & SYS_FLAG_AUTHENTICATE) - proto_config(PROTO_AUTHENTICATE, (LONG)set); + proto_config(PROTO_AUTHENTICATE, set); req_ack(srcadr, inter, inpkt, INFO_OKAY); } @@ -1311,7 +1331,7 @@ do_monitor(srcadr, inter, inpkt) struct interface *inter; struct req_pkt *inpkt; { - mon_start(); + mon_start(MON_ON); req_ack(srcadr, inter, inpkt, INFO_OKAY); } @@ -1325,7 +1345,7 @@ do_nomonitor(srcadr, inter, inpkt) struct interface *inter; struct req_pkt *inpkt; { - mon_stop(); + mon_stop(MON_ON); req_ack(srcadr, inter, inpkt, INFO_OKAY); } @@ -1497,6 +1517,10 @@ mon_getlist(srcadr, inter, inpkt) md = md->mru_next) { im->lasttime = htonl(current_time - md->lasttime); im->firsttime = htonl(current_time - md->firsttime); + if (md->lastdrop) + im->lastdrop = htonl(current_time - md->lastdrop); + else + im->lastdrop = 0; im->count = htonl(md->count); im->addr = md->rmtadr; im->port = md->rmtport; @@ -2079,6 +2103,57 @@ get_leap_info(srcadr, inter, inpkt) } +#ifdef KERNEL_PLL +/* + * get_kernel_info - get kernel pll/pps information + */ +static void +get_kernel_info(srcadr, inter, inpkt) + struct sockaddr_in *srcadr; + struct interface *inter; + struct req_pkt *inpkt; +{ + register struct info_kernel *ik; + struct timex ntx; + + if (!pll_control) + return; + memset((char *)&ntx, 0, sizeof(ntx)); + (void)ntp_adjtime(&ntx); + + ik = (struct info_kernel *)prepare_pkt(srcadr, inter, inpkt, + sizeof(struct info_kernel)); + + /* + * pll variables + */ + ik->offset = htonl(ntx.offset); + ik->freq = htonl(ntx.freq); + ik->maxerror = htonl(ntx.maxerror); + ik->esterror = htonl(ntx.esterror); + ik->status = htons(ntx.status); + ik->constant = htonl(ntx.constant); + ik->precision = htonl(ntx.precision); + ik->tolerance = htonl(ntx.tolerance); + + /* + * pps variables + */ + ik->ppsfreq = htonl(ntx.ppsfreq); + ik->jitter = htonl(ntx.jitter); + ik->shift = htons(ntx.shift); + ik->stabil = htonl(ntx.stabil); + ik->jitcnt = htonl(ntx.jitcnt); + ik->calcnt = htonl(ntx.calcnt); + ik->errcnt = htonl(ntx.errcnt); + ik->stbcnt = htonl(ntx.stbcnt); + + (void) more_pkt(); + flush_pkt(); +} +#endif /* KERNEL_PLL */ + + #ifdef REFCLOCK /* * get_clock_info - get info about a clock @@ -2203,29 +2278,6 @@ set_clock_fudge(srcadr, inter, inpkt) } #endif -/* - * set_maxskew - set the system maxskew parameter - */ -static void -set_maxskew(srcadr, inter, inpkt) - struct sockaddr_in *srcadr; - struct interface *inter; - struct req_pkt *inpkt; -{ - register u_fp maxskew; - - if (INFO_NITEMS(inpkt->err_nitems) > 1) { - req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); - return; - } - - maxskew = NTOHS_FP(*(u_fp *)(inpkt->data)); - - proto_config(PROTO_MAXSKEW, (LONG)maxskew); - req_ack(srcadr, inter, inpkt, INFO_OKAY); -} - - /* * set_precision - set the system precision */ @@ -2249,31 +2301,6 @@ set_precision(srcadr, inter, inpkt) req_ack(srcadr, inter, inpkt, INFO_OKAY); } - -/* - * set_select_code - set a select code to use - */ -static void -set_select_code(srcadr, inter, inpkt) - struct sockaddr_in *srcadr; - struct interface *inter; - struct req_pkt *inpkt; -{ - register U_LONG select_code; - - select_code = ntohl(*(U_LONG *)(inpkt->data)); - - if (INFO_NITEMS(inpkt->err_nitems) > 1 || - select_code < SELECT_1 || select_code > SELECT_5) { - req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); - return; - } - - proto_config(PROTO_SELECT, (LONG)select_code); - req_ack(srcadr, inter, inpkt, INFO_OKAY); -} - - #ifdef REFCLOCK /* * get_clkbug_info - get debugging info about a clock diff --git a/contrib/xntpd/xntpd/ntp_restrict.c b/contrib/xntpd/xntpd/ntp_restrict.c index 51d896806207..43f01f296624 100644 --- a/contrib/xntpd/xntpd/ntp_restrict.c +++ b/contrib/xntpd/xntpd/ntp_restrict.c @@ -1,4 +1,4 @@ -/* ntp_restrict.c,v 3.1 1993/07/06 01:11:28 jbj Exp +/* * ntp_restrict.c - find out what restrictions this host is running under */ #include @@ -59,6 +59,21 @@ U_LONG res_found; U_LONG res_not_found; U_LONG res_timereset; +/* + * Parameters of the RES_LIMITED restriction option. + * client_limit is the number of hosts allowed per source net + * client_limit_period is the number of seconds after which an entry + * is no longer considered for client limit determination + */ +U_LONG client_limit; +U_LONG client_limit_period; +/* + * count number of restriction entries referring to RES_LIMITED + * controls activation/deactivation of monitoring + * (with respect ro RES_LIMITED control) + */ +U_LONG res_limited_refcnt; + /* * Our initial allocation of list entries. */ @@ -69,6 +84,11 @@ static struct restrictlist resinit[INITRESLIST]; */ extern U_LONG current_time; +/* + * debug flag + */ +extern int debug; + /* * init_restrict - initialize the restriction data structures */ @@ -76,6 +96,7 @@ void init_restrict() { register int i; + char bp[80]; /* * Zero the list and put all but one on the free list @@ -108,6 +129,18 @@ init_restrict() res_found = 0; res_not_found = 0; res_timereset = 0; + + /* + * set default values for RES_LIMIT functionality + */ + client_limit = 3; + client_limit_period = 3600; + res_limited_refcnt = 0; + + sprintf(bp, "client_limit=%d", client_limit); + set_sys_var(bp, strlen(bp)+1, RO); + sprintf(bp, "client_limit_period=%d", client_limit_period); + set_sys_var(bp, strlen(bp)+1, RO); } @@ -150,6 +183,120 @@ restrictions(srcadr) else res_found++; + /* + * The following implements limiting the number of clients + * accepted from a given network. The notion of "same network" + * is determined by the mask and addr fields of the restrict + * list entry. The monitor mechanism has to be enabled for + * collecting info on current clients. + * + * The policy is as follows: + * - take the list of clients recorded + * from the given "network" seen within the last + * client_limit_period seconds + * - if there are at most client_limit entries: + * --> access allowed + * - otherwise sort by time first seen + * - current client among the first client_limit seen + * hosts? + * if yes: access allowed + * else: eccess denied + */ + if (match->flags & RES_LIMITED) { + int lcnt; + struct mon_data *md, *this_client; + extern int mon_enabled; + extern struct mon_data mon_fifo_list, mon_mru_list; + +#ifdef DEBUG + if (debug > 2) + printf("limited clients check: %d clients, period %d seconds, net is 0x%X\n", + client_limit, client_limit_period, + netof(hostaddr)); +#endif /*DEBUG*/ + if (mon_enabled == MON_OFF) { +#ifdef DEBUG + if (debug > 4) + printf("no limit - monitoring is off\n"); +#endif + return (int)(match->flags & ~RES_LIMITED); + } + + /* + * How nice, MRU list provides our current client as the + * first entry in the list. + * Monitoring was verified to be active above, thus we + * know an entry for our client must exist, or some + * brain dead set the memory limit for mon entries to ZERO!!! + */ + this_client = mon_mru_list.mru_next; + + for (md = mon_fifo_list.fifo_next,lcnt = 0; + md != &mon_fifo_list; + md = md->fifo_next) { + if ((current_time - md->lasttime) + > client_limit_period) { +#ifdef DEBUG + if (debug > 5) + printf("checking: %s: ignore: too old: %d\n", + numtoa(md->rmtadr), + current_time - md->lasttime); +#endif + continue; + } + if (md->mode == MODE_BROADCAST || + md->mode == MODE_CONTROL || + md->mode == MODE_PRIVATE) { +#ifdef DEBUG + if (debug > 5) + printf("checking: %s: ignore mode %d\n", + numtoa(md->rmtadr), + md->mode); +#endif + continue; + } + if (netof(md->rmtadr) != + netof(hostaddr)) { +#ifdef DEBUG + if (debug > 5) + printf("checking: %s: different net 0x%X\n", + numtoa(md->rmtadr), + netof(md->rmtadr)); +#endif + continue; + } + lcnt++; + if (lcnt > client_limit || + md->rmtadr == hostaddr) { +#ifdef DEBUG + if (debug > 5) + printf("considering %s: found host\n", + numtoa(md->rmtadr)); +#endif + break; + } +#ifdef DEBUG + else { + if (debug > 5) + printf("considering %s: same net\n", + numtoa(md->rmtadr)); + } +#endif + + } +#ifdef DEBUG + if (debug > 4) + printf("this one is rank %d in list, limit is %d: %s\n", + lcnt, client_limit, + (lcnt <= client_limit) ? "ALLOW" : "REJECT"); +#endif + if (lcnt <= client_limit) { + this_client->lastdrop = 0; + return (int)(match->flags & ~RES_LIMITED); + } else { + this_client->lastdrop = current_time; + } + } return (int)match->flags; } @@ -257,6 +404,10 @@ restrict(op, resaddr, resmask, mflags, flags) rlprev->next = rl; restrictcount++; } + if ((rl->flags ^ (u_short)flags) & RES_LIMITED) { + res_limited_refcnt++; + mon_start(MON_RES); /* ensure data gets collected */ + } rl->flags |= (u_short)flags; break; @@ -265,8 +416,14 @@ restrict(op, resaddr, resmask, mflags, flags) * Remove some bits from the flags. If we didn't * find this one, just return. */ - if (rl != 0) + if (rl != 0) { + if ((rl->flags ^ (u_short)flags) & RES_LIMITED) { + res_limited_refcnt--; + if (res_limited_refcnt == 0) + mon_stop(MON_RES); + } rl->flags &= (u_short)~flags; + } break; case RESTRICT_REMOVE: @@ -280,6 +437,11 @@ restrict(op, resaddr, resmask, mflags, flags) && !(rl->mflags & RESM_INTERFACE)) { rlprev->next = rl->next; restrictcount--; + if (rl->flags & RES_LIMITED) { + res_limited_refcnt--; + if (res_limited_refcnt == 0) + mon_stop(MON_RES); + } memset((char *)rl, 0, sizeof(struct restrictlist)); rl->next = resfree; diff --git a/contrib/xntpd/xntpd/ntp_unixclock.c b/contrib/xntpd/xntpd/ntp_unixclock.c index 6b661835dbb7..1950d8c06fb3 100644 --- a/contrib/xntpd/xntpd/ntp_unixclock.c +++ b/contrib/xntpd/xntpd/ntp_unixclock.c @@ -251,10 +251,23 @@ clock_parms(tickadj, tick) * Note that this version grovels about in /dev/kmem to determine * these values. This probably should be elsewhere. */ - -/* Define the following to be what the tick and tickadj variables are - * called in your kernel. +#if defined(SYS_UNIXWARE1) +/* + * clock_parms - return the local clock tickadj and tick parameters + * + * The values set here were determined experimentally on a 486 system + * I'm not confident in them. - RAS + * */ +static void +clock_parms(tickadj, tick) + U_LONG *tickadj; + U_LONG *tick; +{ + *tick = 10000; /* microseconds */ + *tickadj = 80; /* microseconds */ +} +#else /* SYS_UNIXWARE1 */ #if defined(SYS_AUX3) || defined(SYS_AUX2) || defined(SYS_SVR4) || defined(SYS_PTX) #define K_TICKADJ_NAME "tickadj" @@ -373,6 +386,7 @@ clock_parms(tickadj, tick) #undef K_TICK_NAME #undef N_NAME } +#endif /* SYS_UNIXWARE1 */ #endif /* HAVE_READKMEM */ #if defined(SOLARIS)&&defined(ADJTIME_IS_ACCURATE) @@ -421,7 +435,6 @@ clock_parms(tickadj, tick) } #endif /* sgi */ - #ifdef NOKMEM #ifndef HZ @@ -556,13 +569,18 @@ clock_parms(tickadj, tick) #endif /* SOLARIS */ #ifdef SYS_LINUX -/* XXX should look this up somewhere ! */ +#include static void clock_parms(tickadj, tick) U_LONG *tickadj; U_LONG *tick; { - *tickadj = (U_LONG)1; - *tick = (U_LONG)10000; + struct timex txc; + + txc.mode = 0; + __adjtimex(&txc); + + *tickadj = (U_LONG)1; /* our adjtime is accurate */ + *tick = (U_LONG)txc.tick; } #endif /* SYS_LINUX */ diff --git a/contrib/xntpd/xntpd/ntpd.c b/contrib/xntpd/xntpd/ntpd.c index abe86d945151..9ed43c5c4a81 100644 --- a/contrib/xntpd/xntpd/ntpd.c +++ b/contrib/xntpd/xntpd/ntpd.c @@ -14,7 +14,7 @@ #include #endif -#if defined(SYS_SVR4) +#if defined(SYS_SVR4) || defined (SYS_UNIXWARE1) #include #endif @@ -28,8 +28,12 @@ #include "ntp_stdlib.h" #ifdef LOCK_PROCESS +#ifdef SYS_SOLARIS +#include +#else #include #endif +#endif /* * Signals we catch for debugging. If not debugging we ignore them. @@ -139,7 +143,7 @@ main(argc, argv) (void) dup2(0, 1); (void) dup2(0, 2); #ifdef NTP_POSIX_SOURCE -#if defined(SOLARIS) || defined(SYS_PTX) || defined(SYS_AUX3) || defined(SYS_AIX) +#if defined(SOLARIS) || defined(SYS_PTX) || defined(SYS_AUX3) || defined(SYS_AIX) || defined(SYS_ULTRIX) (void) setsid(); #else (void) setpgid(0, 0); @@ -219,13 +223,23 @@ main(argc, argv) if (rtprio(0, 120) < 0) syslog(LOG_ERR, "rtprio() error: %m"); #else -#if defined(PROCLOCK) && defined(LOCK_PROCESS) +#if defined(LOCK_PROCESS) +#if defined(MCL_CURRENT) && defined(MCL_FUTURE) + /* + * lock the process into memory + */ + if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) + syslog(LOG_ERR, "mlockall(): %m"); +#else +#if defined(PROCLOCK) /* * lock the process into memory */ if (plock(PROCLOCK) < 0) syslog(LOG_ERR, "plock(): %m"); #endif +#endif +#endif #if defined(NTPD_PRIO) && NTPD_PRIO != 0 /* * Set the priority. diff --git a/contrib/xntpd/xntpd/refclock_chu.c b/contrib/xntpd/xntpd/refclock_chu.c index 1c7c3bfa61c1..4596db22e2f5 100644 --- a/contrib/xntpd/xntpd/refclock_chu.c +++ b/contrib/xntpd/xntpd/refclock_chu.c @@ -598,6 +598,25 @@ chu_receive(rbufp) chu->responses++; chu->lastupdate = current_time; + /* + * Just for fun, we can debug the whole frame if + * we want. + */ + +#ifdef CHU_DEBUG + syslog(LOG_DEBUG, "CHU %s packet:", (chuc->chutype == CHU_YEAR)? + "year":"time"); + for (i=0; i < NCHUCHARS; i++) { + char c[64]; + + sprintf(c,"%c%c %s",hexstring[chuc->codechars[i]&0xf], + hexstring[chuc->codechars[i]>>4], + ctime(&(chuc->codetimes[i].tv_sec))); + c[strlen(c)-1]=0; /* ctime() adds a damn \n */ + syslog(LOG_DEBUG, "%s .%06d", c, chuc->codetimes[i].tv_usec); + } +#endif + /* * At this point we're assured that both halves of the * data match because of what the kernel has done. diff --git a/contrib/xntpd/xntpd/refclock_conf.c b/contrib/xntpd/xntpd/refclock_conf.c index 430c4a60f3fa..535ca27e9ebe 100644 --- a/contrib/xntpd/xntpd/refclock_conf.c +++ b/contrib/xntpd/xntpd/refclock_conf.c @@ -20,6 +20,12 @@ extern struct refclock refclock_local; #define refclock_local refclock_none #endif +#if defined(TRAK) || defined(TRAKCLK) || defined(TRAKPPS) +extern struct refclock refclock_trak; +#else +#define refclock_trak refclock_none +#endif + #if defined(PST) || defined(PSTCLK) || defined(PSTPPS) extern struct refclock refclock_pst; #else @@ -107,7 +113,7 @@ extern struct refclock refclock_gpstm; struct refclock *refclock_conf[] = { &refclock_none, /* 0 REFCLK_NONE */ &refclock_local, /* 1 REFCLK_LOCAL */ - &refclock_none, /* 2 REFCLK_WWV_HEATH */ + &refclock_trak, /* 2 REFCLK_GPS_TRAK */ &refclock_pst, /* 3 REFCLK_WWV_PST */ &refclock_wwvb, /* 4 REFCLK_WWVB_SPECTRACOM */ &refclock_goes, /* 5 REFCLK_GOES_TRUETIME */ diff --git a/contrib/xntpd/xntpd/refclock_irig.c b/contrib/xntpd/xntpd/refclock_irig.c index 40345bbefde7..6167af2784ee 100644 --- a/contrib/xntpd/xntpd/refclock_irig.c +++ b/contrib/xntpd/xntpd/refclock_irig.c @@ -19,7 +19,7 @@ * This driver supports the IRIG audio decoder. This clever gadget uses * a modified BSD audio driver for the Sun SPARCstation which provides * a timestamp, raw binary timecode, status byte and decoded ASCII - # timecode. The data are represented in the structure: + * timecode. The data are represented in the structure: * * struct irig_time { * struct timeval stamp; timestamp @@ -418,7 +418,9 @@ struct peer *peer; irig->hour = MULBY10(cp[4] - '0') + cp[5] - '0'; irig->minute = MULBY10(cp[7] - '0') + cp[8] - '0'; irig->second = MULBY10(cp[10] - '0') + cp[11] - '0'; - if (cp[12] != ' ') + if (cp[12] = ' ') + irig->leap = 0; + else irig->leap = LEAP_NOTINSYNC; if (irig->day < 1 || irig->day > 366) { irig->baddata++; diff --git a/contrib/xntpd/xntpd/refclock_msfees.c b/contrib/xntpd/xntpd/refclock_msfees.c index b301bc2ebb23..c2a882abb919 100644 --- a/contrib/xntpd/xntpd/refclock_msfees.c +++ b/contrib/xntpd/xntpd/refclock_msfees.c @@ -139,7 +139,7 @@ #define INH_DELAY_PPS BITS_TO_L_FP( 0, 9600) #ifndef STREAM_PP1 -#define STREAM_PP1 "ppsclockd\0<-- patch space for module name1 -->" +#define STREAM_PP1 "ppsclocd\0<-- patch space for module name1 -->" #endif #ifndef STREAM_PP2 #define STREAM_PP2 "ppsclock\0<-- patch space for module name2 -->" diff --git a/contrib/xntpd/xntpd/refclock_parse.c b/contrib/xntpd/xntpd/refclock_parse.c index 69e483764354..0d95d18908a5 100644 --- a/contrib/xntpd/xntpd/refclock_parse.c +++ b/contrib/xntpd/xntpd/refclock_parse.c @@ -1,8 +1,8 @@ #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS)) /* - * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp + * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp * - * refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp + * refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp * * generic reference clock driver for receivers * @@ -30,6 +30,8 @@ * PPS - supply loopfilter with PPS samples (if configured) * PPSPPS - notify loopfilter of PPS file descriptor * + * FREEBSD_CONRAD - Make very cheap "Conrad DCF77 RS-232" gadget work + * with FreeBSD. * TTY defines: * HAVE_BSD_TTYS - currently unsupported * HAVE_SYSV_TTYS - will use termio.h @@ -82,6 +84,9 @@ #include #include +#ifdef FREEBSD_CONRAD +#include +#endif extern int errno; #if !defined(STREAM) && !defined(HAVE_SYSV_TTYS) && !defined(HAVE_BSD_TTYS) && !defined(HAVE_TERMIOS) @@ -129,7 +134,7 @@ CURRENTLY NO BSD TTY SUPPORT #include "parse.h" #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__) -static char rcsid[]="refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp"; +static char rcsid[]="refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp"; #endif /**=========================================================================== @@ -440,7 +445,12 @@ static poll_info_t wsdcf_pollinfo = { WS_POLLRATE, WS_POLLCMD, WS_CMDSIZE }; #define RAWDCF_ROOTDELAY 0x00000364 /* 13 ms */ #define RAWDCF_FORMAT "RAW DCF77 Timecode" #define RAWDCF_MAXUNSYNC (0) /* sorry - its a true receiver - no signal - no time */ + +#ifdef FREEBSD_CONRAD +#define RAWDCF_CFLAG (CS8|CREAD|CLOCAL) +#else #define RAWDCF_CFLAG (B50|CS8|CREAD|CLOCAL) +#endif #define RAWDCF_IFLAG 0 #define RAWDCF_OFLAG 0 #define RAWDCF_LFLAG 0 @@ -1482,11 +1492,22 @@ local_receive(rbufp) struct parseunit *parse = (struct parseunit *)rbufp->recv_srcclock; register int count; register char *s; +#ifdef FREEBSD_CONRAD + struct timeval foo; +#endif + /* * eat all characters, parsing then and feeding complete samples */ count = rbufp->recv_length; s = rbufp->recv_buffer; +#ifdef FREEBSD_CONRAD + ioctl(parse->fd,TIOCTIMESTAMP,&foo); + TVTOTS(&foo, &rbufp->recv_time); + rbufp->recv_time.l_uf += TS_ROUNDBIT; + rbufp->recv_time.l_ui += JAN_1970; + rbufp->recv_time.l_uf &= TS_MASK; +#endif while (count--) { @@ -1653,7 +1674,8 @@ local_poll(parse) * done if no more characters are available */ FD_SET(fd, &fdmask); - if (select(fd + 1, &fdmask, 0, 0, &null_time) == 0) + if ((i == 0) && + (select(fd + 1, &fdmask, 0, 0, &null_time) == 0)) return; } } @@ -1706,7 +1728,8 @@ parsestate(state, buffer) { PARSEB_NOSYNC, "TIME CODE NOT CONFIRMED" }, { PARSEB_DST, "DST" }, { PARSEB_UTC, "UTC DISPLAY" }, - { PARSEB_LEAP, "LEAP WARNING" }, + { PARSEB_LEAPADD, "LEAP ADD WARNING" }, + { PARSEB_LEAPDEL, "LEAP DELETE WARNING" }, { PARSEB_LEAPSECOND, "LEAP SECOND" }, { PARSEB_ALTERNATE,"ALTERNATE ANTENNA" }, { PARSEB_TIMECODE, "TIME CODE" }, @@ -2269,7 +2292,10 @@ parse_start(sysunit, peer) tm.c_iflag = clockinfo[type].cl_iflag; tm.c_oflag = clockinfo[type].cl_oflag; tm.c_lflag = clockinfo[type].cl_lflag; - +#ifdef FREEBSD_CONRAD + tm.c_ispeed = 50; + tm.c_ospeed = 50; +#endif if (TTY_SETATTR(fd232, &tm) == -1) { syslog(LOG_ERR, "PARSE receiver #%d: parse_start: tcsetattr(%d, &tm): %m", unit, fd232); @@ -2312,6 +2338,21 @@ parse_start(sysunit, peer) return 0; /* well, ok - special initialisation broke */ } +#ifdef FREEBSD_CONRAD + { + int i,j; + struct timeval tv; + ioctl(parse->fd,TIOCTIMESTAMP,&tv); + j = TIOCM_RTS; + i = ioctl(fd232, TIOCMBIC, &j); + if (i < 0) { + syslog(LOG_ERR, + "PARSE receiver #%d: lowrts_poll: failed to lower RTS: %m", + CL_UNIT(parse->unit)); + } + } +#endif + strcpy(tmp_ctl.parseformat.parse_buffer, parse->parse_type->cl_format); tmp_ctl.parseformat.parse_count = strlen(tmp_ctl.parseformat.parse_buffer); @@ -2539,9 +2580,10 @@ static void parse_leap() { /* - * PARSE does encode a leap warning... we are aware but not afraid of that - * as long as we get a little help for the direction from the operator until * PARSE encodes the LEAP correction direction. + * For timecodes that do not pass on the leap correction direction + * the default PARSEB_LEAPADD must be used. It may then be modified + * with a fudge flag (flag2). */ } @@ -2821,7 +2863,7 @@ parse_control(unit, in, out) sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description); tt = add_var(&out->kv_list, 128, RO); - sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.45 1994/01/25 19:06:27 kardel Exp\""); + sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp\""); out->lencode = strlen(outstatus); out->lastcode = outstatus; @@ -3100,7 +3142,11 @@ parse_process(parse, parsetime) L_ADD(&off, &offset); rectime = off; /* this makes org time and xmt time somewhat artificial */ - if (parse->flags & PARSE_STAT_FILTER) + L_SUB(&off, &parsetime->parse_stime.fp); + + if ((parse->flags & PARSE_STAT_FILTER) && + (off.l_i > -60) && + (off.l_i < 60)) /* take usec error only if within +- 60 secs */ { struct timeval usecerror; /* @@ -3112,10 +3158,6 @@ parse_process(parse, parsetime) sTVTOTS(&usecerror, &off); L_ADD(&off, &offset); } - else - { - L_SUB(&off, &parsetime->parse_stime.fp); - } } if (PARSE_PPS(parsetime->parse_state) && CL_PPS(parse->unit)) @@ -3245,14 +3287,24 @@ parse_process(parse, parsetime) } else { - if (PARSE_LEAP(parsetime->parse_state)) + if (PARSE_LEAPADD(parsetime->parse_state)) { + /* + * we pick this state also for time code that pass leap warnings + * without direction information (as earth is currently slowing + * down). + */ leap = (parse->flags & PARSE_LEAP_DELETE) ? LEAP_DELSECOND : LEAP_ADDSECOND; } else - { - leap = LEAP_NOWARNING; - } + if (PARSE_LEAPDEL(parsetime->parse_state)) + { + leap = LEAP_DELSECOND; + } + else + { + leap = LEAP_NOWARNING; + } } refclock_receive(parse->peer, &off, 0, LFPTOFP(&dispersion), &reftime, &rectime, leap); @@ -3396,6 +3448,21 @@ trimble_init(parse) * History: * * refclock_parse.c,v + * Revision 3.53 1994/03/25 13:07:39 kardel + * fixed offset calculation for large (>4 Min) offsets + * + * Revision 3.52 1994/03/03 09:58:00 kardel + * stick -kv in cvs is no fun + * + * Revision 3.49 1994/02/20 13:26:00 kardel + * rcs id cleanup + * + * Revision 3.48 1994/02/20 13:04:56 kardel + * parse add/delete second support + * + * Revision 3.47 1994/02/02 17:44:30 kardel + * rcs ids fixed + * * Revision 3.45 1994/01/25 19:06:27 kardel * 94/01/23 reconcilation * diff --git a/contrib/xntpd/xntpd/refclock_trak.c b/contrib/xntpd/xntpd/refclock_trak.c new file mode 100644 index 000000000000..f2b3eb11fc9d --- /dev/null +++ b/contrib/xntpd/xntpd/refclock_trak.c @@ -0,0 +1,1006 @@ +/* + * refclock_trak.c - clock driver for the TRAK 8810 GPS STATION CLOCK + * Tsuruoka Tomoaki Oct 30, 1993 + * tsuruoka@nc.fukuoka-u.ac.jp + * Faculty of Engineering, + * Fukuoka University, Fukuoka, JAPAN + */ +#if defined(REFCLOCK) && (defined(TRAK) || defined(TRAKCLK) || defined(TRAKPPS)) + +#include +#include +#include + +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_refclock.h" +#include "ntp_unixtime.h" + +static void gps_send(); + +#if defined(HAVE_BSD_TTYS) +#include +#endif /* HAVE_BSD_TTYS */ + +#if defined(HAVE_SYSV_TTYS) +#include +#endif /* HAVE_SYSV_TTYS */ + +#if defined(STREAM) +#include +#include +#if defined(TRAKCLK) +#include +#endif /* TRAKCLK */ +#endif /* STREAM */ + +#if defined (TRAKPPS) +#include +#endif /* TRAKPPS */ + +#include "ntp_stdlib.h" + +/* + * This driver supports the TRAK 8810 GPS Receiver with + * Buffered RS-232-C Interface Module. + * + * Most of codes are copied from refclock_as2201.c, Thanks a lot. + * + * The program expects the radio responses once per seccond + * ( by "rqts,u" command or panel control ) + * of the form "*RQTS U,ddd:hh:mm:ss.0,Q\r\n for UTC" where + * ddd= day of year + * hh= hours + * mm= minutes + * ss= seconds + * Q= Quality byte. Q=0 Phase error > 20 us + * Q=6 Pahse error < 20 us + * > 10 us + * Q=5 Pahse error < 10 us + * > 1 us + * Q=4 Pahse error < 1 us + * > 100 ns + * Q=3 Pahse error < 100 ns + * > 10 ns + * Q=2 Pahse error < 10 ns + * (note that my clock almost stable at 1 us per 10 hours) + * + * Request leap second status - if needed. + * send: rqls\n + * reply: RQLS yy,mm,dd + * where: yy is year + * mm is month + * dd is day of month.baud + * Note: Default data is all zeros + * i.e. RQLS 00,00,00 + */ + +/* + * Definitions + */ +#define MAXUNITS 4 /* max number of GPS units */ +#define GPS232 "/dev/gps%d" /* name of radio device */ +#define SPEED232 B9600 /* uart speed (9600 bps) */ + +/* + * Radio interface parameters + */ +#define GPSPRECISION (-20) /* precision assumed (about 1 us) */ +#define GPSREFID "GPS" /* reference id */ +#define GPSDESCRIPTION "TRAK 8810 GPS station clock" /* who we are */ +#define GPSHSREFID 0x7f7f020a /* 127.127.2.10 refid hi strata */ +#define GMT 0 /* hour offset from Greenwich */ +#define NCODES 3 /* stages of median filter */ +#define LENTOC 25 /* *RQTS U,ddd:hh:mm:ss.0,Q datecode length */ +#define BMAX 100 /* timecode buffer length */ +#define CODEDIFF 0x20000000 /* 0.125 seconds as an l_fp fraction */ + +/* + * Hack to avoid excercising the multiplier. I have no pride. + */ +#define MULBY10(x) (((x)<<3) + ((x)<<1)) + +/* + * Imported from ntp_timer module + */ +extern U_LONG current_time; /* current time (s) */ + +/* + * Imported from ntp_loopfilter module + */ +extern int fdpps; /* pps file descriptor */ + +/* + * Imported from ntpd module + */ +extern int debug; /* global debug flag */ + +/* + * GPS unit control structure. + */ +struct gpsunit { + struct peer *peer; /* associated peer structure */ + struct refclockio io; /* given to the I/O handler */ + l_fp lastrec; /* last data receive time */ + l_fp lastref; /* last timecode time */ + l_fp offset[NCODES]; /* recent sample offsets */ + char lastcode[BMAX]; /* last timecode received */ + u_short polled; /* when polled, means a last sample */ + u_char lencode; /* length of last received ASCII string */ + U_LONG lasttime; /* last time clock heard from */ +#ifdef TRAKPPS + U_LONG lastev; /* last ppsclock second */ +#endif /* TRAKPPS */ + u_char unit; /* unit number for this guy */ + u_char status; /* clock status */ + u_char lastevent; /* last clock event */ + u_char reason; /* reason for last abort */ + u_char year; /* year of eternity */ + u_short day; /* day of year */ + u_char hour; /* hour of day */ + u_char minute; /* minute of hour */ + u_char second; /* seconds of minute */ + u_short msec; /* milliseconds of second */ + u_char leap; /* leap indicators */ + U_LONG yearstart; /* start of current year */ + /* + * Status tallies + */ + U_LONG polls; /* polls sent */ + U_LONG noreply; /* no replies to polls */ + U_LONG coderecv; /* timecodes received */ + U_LONG badformat; /* bad format */ + U_LONG baddata; /* bad data */ + U_LONG timestarted; /* time we started this */ +}; + + +/* + * Data space for the unit structures. Note that we allocate these on + * the fly, but never give them back. + */ +static struct gpsunit *gpsunits[MAXUNITS]; +static u_char unitinuse[MAXUNITS]; + +/* + * Keep the fudge factors separately so they can be set even + * when no clock is configured. + */ +static l_fp fudgefactor[MAXUNITS]; +static u_char stratumtouse[MAXUNITS]; +static u_char sloppyclockflag[MAXUNITS]; + +/* + * Function prototypes + */ +static void trak_init P(()); +static int trak_start P((u_int, struct peer *)); +static void trak_shutdown P((int)); +static void trak_report_event P((struct gpsunit *, int)); +static void trak_receive P((struct recvbuf *)); +static char trak_process P((struct gpsunit *, l_fp *, u_fp *)); +static void trak_poll P((int unit, struct peer *)); +static void trak_control P((u_int, struct refclockstat *, struct refclockstat *)); +static void trak_buginfo P((int, struct refclockbug *)); + +/* + * Transfer vector + */ +struct refclock refclock_trak = { + trak_start, trak_shutdown, trak_poll, + trak_control, trak_init, trak_buginfo, NOFLAGS +}; + +/* + * trak_init - initialize internal gps driver data + */ +static void +trak_init() +{ + register int i; + /* + * Just zero the data arrays + */ + memset((char *)gpsunits, 0, sizeof gpsunits); + memset((char *)unitinuse, 0, sizeof unitinuse); + + /* + * Initialize fudge factors to default. + */ + for (i = 0; i < MAXUNITS; i++) { + fudgefactor[i].l_ui = 0; + fudgefactor[i].l_uf = 0; + stratumtouse[i] = 0; + sloppyclockflag[i] = 0; + } +} + + +/* + * trak_start - open the GPS devices and initialize data for processing + */ +static int +trak_start(unit, peer) + u_int unit; + struct peer *peer; +{ + register struct gpsunit *gps; + register int i; + int fd232; + char trakdev[20]; +#ifdef TRAKPPS + struct ppsclockev ev; +#endif /* TRAKPPS */ + + /* + * Check configuration info + */ + if (unit >= MAXUNITS) { + syslog(LOG_ERR, "trak_start: unit %d invalid", unit); + return (0); + } + if (unitinuse[unit]) { + syslog(LOG_ERR, "trak_start: unit %d in use", unit); + return (0); + } + + /* + * Open serial port + */ + (void) sprintf(trakdev, GPS232, unit); + fd232 = open(trakdev, O_RDWR, 0777); + if (fd232 == -1) { + syslog(LOG_ERR, "trak_start: open of %s: %m", trakdev); + return (0); + } + +#if defined(HAVE_SYSV_TTYS) + /* + * System V serial line parameters (termio interface) + * + */ + { struct termio ttyb; + if (ioctl(fd232, TCGETA, &ttyb) < 0) { + syslog(LOG_ERR, + "trak_start: ioctl(%s, TCGETA): %m", trakdev); + goto screwed; + } + ttyb.c_iflag = IGNBRK|IGNPAR|ICRNL; + ttyb.c_oflag = 0; + ttyb.c_cflag = SPEED232|CS8|CLOCAL|CREAD; + ttyb.c_lflag = ICANON; + ttyb.c_cc[VERASE] = ttyb.c_cc[VKILL] = '\0'; + if (ioctl(fd232, TCSETA, &ttyb) < 0) { + syslog(LOG_ERR, + "trak_start: ioctl(%s, TCSETA): %m", trakdev); + goto screwed; + } + } +#endif /* HAVE_SYSV_TTYS */ +#if defined(STREAM) + /* + * POSIX/STREAMS serial line parameters (termios interface) + * + * The TRAKCLK option provides timestamping at the driver level. + * It requires the tty_clk streams module. + * + * The TRAKPPS option provides timestamping at the driver level. + * It uses a 1-pps signal and level converter (gadget box) and + * requires the ppsclock streams module and SunOS 4.1.1 or + * later. + */ + { struct termios ttyb, *ttyp; + + ttyp = &ttyb; + if (tcgetattr(fd232, ttyp) < 0) { + syslog(LOG_ERR, + "trak_start: tcgetattr(%s): %m", trakdev); + goto screwed; + } + ttyp->c_iflag = IGNBRK|IGNPAR; + ttyp->c_oflag = 0; + ttyp->c_cflag = SPEED232|CS8|CLOCAL|CREAD; + ttyp->c_lflag = ICANON; + ttyp->c_cc[VERASE] = ttyp->c_cc[VKILL] = '\0'; + if (tcsetattr(fd232, TCSANOW, ttyp) < 0) { + syslog(LOG_ERR, + "trak_start: tcsetattr(%s): %m", trakdev); + goto screwed; + } + if (tcflush(fd232, TCIOFLUSH) < 0) { + syslog(LOG_ERR, + "trak_start: tcflush(%s): %m", trakdev); + goto screwed; + } +#if defined(TRAKCLK) + if (ioctl(fd232, I_PUSH, "clk") < 0) + syslog(LOG_ERR, + "trak_start: ioctl(%s, I_PUSH, clk): %m", trakdev); + if (ioctl(fd232, CLK_SETSTR, "*") < 0) + syslog(LOG_ERR, + "trak_start: ioctl(%s, CLK_SETSTR): %m", trakdev); +#endif /* TRAKCLK */ +#if defined(TRAKPPS) + if (ioctl(fd232, I_PUSH, "ppsclock") < 0) + syslog(LOG_ERR, + "trak_start: ioctl(%s, I_PUSH, ppsclock): %m", trakdev); + else + fdpps = fd232; +#endif /* TRAKPPS */ + } +#endif /* STREAM */ +#if defined(HAVE_BSD_TTYS) + /* + * 4.3bsd serial line parameters (sgttyb interface) + * + * The TRAKCLK option provides timestamping at the driver level. + * It requires the tty_clk line discipline and 4.3bsd or later. + */ + { struct sgttyb ttyb; +#if defined(TRAKCLK) + int ldisc = CLKLDISC; +#endif /* TRAKCLK */ + + if (ioctl(fd232, TIOCGETP, &ttyb) < 0) { + syslog(LOG_ERR, + "trak_start: ioctl(%s, TIOCGETP): %m", trakdev); + goto screwed; + } + ttyb.sg_ispeed = ttyb.sg_ospeed = SPEED232; +#if defined(TRAKCLK) + ttyb.sg_erase = ttyb.sg_kill = '\r'; + ttyb.sg_flags = RAW; +#else + ttyb.sg_erase = ttyb.sg_kill = '\0'; + ttyb.sg_flags = EVENP|ODDP|CRMOD; +#endif /* TRAKCLK */ + if (ioctl(fd232, TIOCSETP, &ttyb) < 0) { + syslog(LOG_ERR, + "trak_start: ioctl(%s, TIOCSETP): %m", trakdev); + goto screwed; + } +#if defined(TRAKCLK) + if (ioctl(fd232, TIOCSETD, &ldisc) < 0) { + syslog(LOG_ERR, + "trak_start: ioctl(%s, TIOCSETD): %m",trakdev); + goto screwed; + } +#endif /* TRAKCLK */ + } +#endif /* HAVE_BSD_TTYS */ + + /* + * Allocate unit structure + */ + if (gpsunits[unit] != 0) { + gps = gpsunits[unit]; /* The one we want is okay */ + } else { + for (i = 0; i < MAXUNITS; i++) { + if (!unitinuse[i] && gpsunits[i] != 0) + break; + } + if (i < MAXUNITS) { + /* + * Reclaim this one + */ + gps = gpsunits[i]; + gpsunits[i] = 0; + } else { + gps = (struct gpsunit *) + emalloc(sizeof(struct gpsunit)); + } + } + bzero((char *)gps, sizeof(struct gpsunit)); + gpsunits[unit] = gps; + + /* + * Set up the structures + */ + gps->peer = peer; + gps->unit = (u_char)unit; + gps->timestarted = current_time; + + gps->io.clock_recv = trak_receive; + gps->io.srcclock = (caddr_t)gps; + gps->io.datalen = 0; + gps->io.fd = fd232; +#ifdef TRAKPPS + if (ioctl(fd232, CIOGETEV, (caddr_t)&ev) < 0) { + syslog(LOG_ERR, + "trak_start: ioctl(%s, CIOGETEV): %m", trakdev); + goto screwed; + } else + gps->lastev = ev.tv.tv_sec; +#endif /* TRAKPPS */ + if (!io_addclock(&gps->io)) { + goto screwed; + } + + /* + * All done. Initialize a few random peer variables, then + * return success. Note that root delay and root dispersion are + * always zero for this clock. + */ + peer->precision = GPSPRECISION; + peer->rootdelay = 0; + peer->rootdispersion = 0; + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) + bcopy(GPSREFID, (char *)&peer->refid, 4); + else + peer->refid = htonl(GPSHSREFID); + unitinuse[unit] = 1; + /* + * request to give time code + */ + { + void gps_send(); + gps_send(gps,"\rRQTS,U\r"); + gps_send(gps,"SEL 00\r"); + } + + return (1); + + /* + * Something broke; abandon ship. + */ +screwed: + (void) close(fd232); + return (0); +} + +/* + * trak_shutdown - shut down a GPS clock + */ +static void +trak_shutdown(unit) + int unit; +{ + register struct gpsunit *gps; + void gps_send(); + + if (unit >= MAXUNITS) { + syslog(LOG_ERR, "trak_shutdown: unit %d invalid", unit); + return; + } + if (!unitinuse[unit]) { + syslog(LOG_ERR, "trak_shutdown: unit %d not in use", unit); + return; + } + gps = gpsunits[unit]; + /* + * request not to give time code any more + */ + gps_send(gps,"RQTX\r"); + /* + * Tell the I/O module to turn us off. We're history. + */ + io_closeclock(&gps->io); + + unitinuse[unit] = 0; +} + + +/* + * trak_report_event - note the occurance of an event + * + * This routine presently just remembers the report and logs it, but + * does nothing heroic for the trap handler. + */ +static void +trak_report_event(gps, code) + struct gpsunit *gps; + int code; +{ + struct peer *peer; + + peer = gps->peer; + if (gps->status != (u_char)code) { + gps->status = (u_char)code; + if (code != CEVNT_NOMINAL) + gps->lastevent = (u_char)code; + syslog(LOG_INFO, + "clock %s event %x\n", ntoa(&peer->srcadr), code); + } +} + + +/* + * trak_receive - receive data from the serial interface + */ +static void +trak_receive(rbufp) + struct recvbuf *rbufp; +{ + register int i,cmdtype; + register struct gpsunit *gps; + +#if defined(TRAKPPS) + struct ppsclockev ev; + l_fp trtmp; +#endif /* TRAKPPS */ + register u_char *dpt; + register u_char *cp; + register u_char *dpend; + l_fp tstmp; + u_fp dispersion; + + /* + * Get the clock this applies to and pointers to the data. + * Edit the timecode to remove control chars and trashbits. + */ + gps = (struct gpsunit *)rbufp->recv_srcclock; + dpt = (u_char *)&rbufp->recv_space; + dpend = dpt + rbufp->recv_length; + cp = (u_char *)gps->lastcode; + + while (dpt < dpend) { +#ifdef TRAKCLK /* prior to TRAKPPS due to timestamp */ + if ((*cp = 0x7f & *dpt++) != '*' ) cp++; + else if (*cp == '*' ) { /* caught magic character */ + if ( dpend - dpt < 8) { + /* short timestamp */ + if(debug) puts("gps: short timestamp."); + return; + } + if (!buftvtots(dpt,&gps->lastrec)) { + /* screwy timestamp */ + if(debug) puts("gps: screwy timestamp."); + return; + } + dpt += 8; + } +#else +#ifdef TRAKPPS + if ((*cp = 0x7f & *dpt++) >= ' ') cp++; +#else + /* both are not specified */ +#endif /* TRAKPPS */ +#endif /* TRAKCLK */ + } + *cp = '\0'; + gps->lencode = cp - (u_char *)gps->lastcode; + if (gps->lencode == 0) return; + +#ifdef DEBUG + if (debug) + printf("gps: timecode %d %s\n", + gps->lencode, gps->lastcode); +#endif + + /* + * We check the timecode format and decode its contents. The + * timecode has format *........RQTS U,ddd:hh:mm:ss.0,Q\r\n). + * 012345678901234567890123 + */ +#define RQTS 0 +#define RQLS 1 + cp = (u_char *)gps->lastcode; + gps->leap = 0; + cmdtype=0; + if(strncmp(cp,"*RQTS",5)==0) { + cmdtype=RQTS; + cp += 8; + } + else if(strncmp(cp,"RQTS",4)==0) { + cmdtype=RQTS; + cp += 7; + } + else if(strncmp(cp,"RQLS",4)==0) { + cmdtype=RQLS; + cp += 5; + } + else + return; + + switch( cmdtype ) { + case RQTS: + /* + * Check time code format of TRAK 8810 + */ + if( !isdigit(cp[0]) || + !isdigit(cp[1]) || + !isdigit(cp[2]) || + cp[3] != ':' || + !isdigit(cp[4]) || + !isdigit(cp[5]) || + cp[6] != ':' || + !isdigit(cp[7]) || + !isdigit(cp[8]) || + cp[9] != ':' || + !isdigit(cp[10])|| + !isdigit(cp[11])) { + gps->badformat++; + trak_report_event(gps, CEVNT_BADREPLY); + return; + } + break; + case RQLS: + /* + * reply for leap second request + */ + if (cp[0] !='0' || cp[1] != '0' ) gps->leap = LEAP_ADDSECOND; + return; + default: + return; + + } + + /* + * Convert date and check values. + */ + gps->day = cp[0] - '0'; + gps->day = MULBY10(gps->day) + cp[1] - '0'; + gps->day = MULBY10(gps->day) + cp[2] - '0'; + if (gps->day < 1 || gps->day > 366) { + gps->baddata++; + trak_report_event(gps, CEVNT_BADDATE); + return; + } + /* + * Convert time and check values. + */ + gps->hour = MULBY10(cp[4] - '0') + cp[5] - '0'; + gps->minute = MULBY10(cp[7] - '0') + cp[8] - '0'; + gps->second = MULBY10(cp[10] - '0') + cp[11] - '0'; + gps->msec = 0; + if (gps->hour > 23 || gps->minute > 59 || gps->second > 59) { + gps->baddata++; + trak_report_event(gps, CEVNT_BADTIME); + return; + } + + if (!gps->polled) return; + + /* + * Test for synchronization Check for quality byte. + */ +/* + switch( cp[15] ) { + case '0': + if(gps->peer->stratum == stratumtouse[gps->unit]) { + gps->peer->stratum = 10 ; + bzero(&gps->peer->refid,4); + } + break; + default: + if(gps->peer->stratum != stratumtouse[gps->unit]) { + gps->peer->stratum = stratumtouse[gps->unit] ; + bcopy(GPSREFID,&gps->peer->refid,4); + } + break; + } +*/ + if( cp[15] == '0') /* TRAK derailed from tracking satellites */ + { + gps->leap = LEAP_NOTINSYNC; + gps->noreply++; + trak_report_event(gps, CEVNT_TIMEOUT); + } + else + { + gps->lasttime = current_time; + if( gps->lastevent == CEVNT_TIMEOUT ) { + gps->status = CEVNT_NOMINAL; + trak_report_event(gps, CEVNT_NOMINAL); + } + } + + /* + * Now, compute the reference time value. Use the heavy + * machinery for the second, which presumably is the one which + * occured at the last pps pulse and which was captured by the + * loop_filter module. All we have to do here is present a + * reasonable facsimile of the time at that pulse so the clock- + * filter and selection machinery declares us truechimer. The + * precision offset within the second is really tuned by the + * loop_filter module. Note that this code does not yet know how + * to do the years and relies on the clock-calendar chip for + * sanity. + */ + +#if defined(TRAKPPS) + + /* + * timestamp must be greater than previous one. + */ + if (ioctl(fdpps, CIOGETEV, (caddr_t)&ev) >= 0) { + ev.tv.tv_sec += (U_LONG)JAN_1970; + TVTOTS(&ev.tv,&gps->lastrec); + if (gps->lastev < ev.tv.tv_sec) { + gps->lastev = ev.tv.tv_sec; + } else { /* in case of 1-pps missing */ + gps->lastev = ev.tv.tv_sec; + return; + } + } + else + return; /* failed to get timestamp */ +#endif /* TRAKPPS */ + + if (!clocktime(gps->day, gps->hour, gps->minute, + gps->second, GMT, gps->lastrec.l_ui, + &gps->yearstart, &gps->lastref.l_ui)) { + gps->baddata++; + trak_report_event(gps, CEVNT_BADTIME); +#ifdef DEBUG + if(debug) printf("gps: bad date \n"); +#endif + return; + } + MSUTOTSF(gps->msec, gps->lastref.l_uf); + tstmp = gps->lastref; + + L_SUB(&tstmp, &gps->lastrec); + L_ADD(&tstmp, &(fudgefactor[gps->unit])); + i = ((int)(gps->coderecv)) % NCODES; + gps->offset[i] = tstmp; + gps->coderecv++; +#if DEBUG + if (debug) + printf("gps: times %s %s %s\n", + ulfptoa(&gps->lastref, 6), ulfptoa(&gps->lastrec, 6), + lfptoa(&tstmp, 6)); +#endif +/* if( tstmp.l_ui != 0 ) return; something wrong */ + + /* + * Process the samples in the median filter, add the fudge + * factor and pass the offset and dispersion along. We use + * lastref as both the reference time and receive time in order + * to avoid being cute, like setting the reference time later + * than the receive time, which may cause a paranoid protocol + * module to chuck out the data. + */ + if (gps->coderecv < NCODES) + return; + if (!trak_process(gps, &tstmp, &dispersion)) { + gps->baddata++; + trak_report_event(gps, CEVNT_BADTIME); + return; + } + refclock_receive(gps->peer, &tstmp, GMT, dispersion, + &gps->lastrec, &gps->lastrec, gps->leap); + /* + * after all, clear polled flag + */ + gps->polled = 0; +} + +/* + * ================================================================== + * gps_send(gps,cmd) Sends a command to the GPS receiver. + * as gps_send(gps,"rqts,u\r"); + * ================================================================== + */ +static void +gps_send(gps,cmd) + struct gpsunit *gps; + char *cmd; +{ + if (write(gps->io.fd, cmd, strlen(cmd)) == -1) { + syslog(LOG_ERR, "gps_send: unit %d: %m", gps->unit); + trak_report_event(gps,CEVNT_FAULT); + } else { + gps->polls++; + } +} + +/* + * trak_process - process a pile of samples from the clock + * + * This routine uses a three-stage median filter to calculate offset and + * dispersion and reduce jitter. The dispersion is calculated as the + * span of the filter (max - min). + */ +static char +trak_process(gps, offset, dispersion) + struct gpsunit *gps; + l_fp *offset; + u_fp *dispersion; +{ + register int i, j; + register U_LONG tmp_ui, tmp_uf; + int not_median1 = -1; /* XXX correct? */ + int not_median2 = -1; /* XXX correct? */ + int median; + u_fp disp_tmp, disp_tmp2; + + /* + * This code implements a three-stage median filter. First, we + * check if the samples are within 125 ms of each other. If not, + * dump the sample set. We take the median of the three offsets + * and use that as the sample offset. There probably is not much + * to be gained by a longer filter, since the clock filter in + * ntp_proto should do its thing. + */ + disp_tmp2 = 0; + for (i = 0; i < NCODES-1; i++) { + for (j = i+1; j < NCODES; j++) { + tmp_ui = gps->offset[i].l_ui; + tmp_uf = gps->offset[i].l_uf; + M_SUB(tmp_ui, tmp_uf, gps->offset[j].l_ui, + gps->offset[j].l_uf); + if (M_ISNEG(tmp_ui, tmp_uf)) { + M_NEG(tmp_ui, tmp_uf); + } + if (tmp_ui != 0 || tmp_uf > CODEDIFF) { + return (0); + } + disp_tmp = MFPTOFP(0, tmp_uf); + if (disp_tmp > disp_tmp2) { + disp_tmp2 = disp_tmp; + not_median1 = i; + not_median2 = j; + } + } + } + if (gps->lasttime == 0) + disp_tmp2 = NTP_MAXDISPERSE; + else + disp_tmp2 = current_time - gps->lasttime; + if (not_median1 == 0) { + if (not_median2 == 1) + median = 2; + else + median = 1; + } else { + median = 0; + } + *offset = gps->offset[median]; + *dispersion = disp_tmp2; + return (1); +} + +/* + * trak_poll - called by the transmit procedure + * + * We go to great pains to avoid changing state here, since there may be + * more than one eavesdropper receiving the same timecode. + */ +static void +trak_poll(unit, peer) + int unit; + struct peer *peer; +{ + struct gpsunit *gps; + + if (unit >= MAXUNITS) { + syslog(LOG_ERR, "trak_poll: unit %d invalid", unit); + return; + } + if (!unitinuse[unit]) { + syslog(LOG_ERR, "trak_poll: unit %d not in use", unit); + return; + } + gps = gpsunits[unit]; + if ((current_time - gps->lasttime) > 150) + trak_report_event(gpsunits[unit], CEVNT_TIMEOUT); + /* + * usually trak_receive can get a timestamp every second + */ +#if !defined(TRAKPPS) && !defined(TRAKCLK) + gettstamp(&gps->lastrec); +#endif + gps->polls++; + /* + * may be polled every 16 seconds (minpoll 4) + */ + gps->polled = 1; +} + +/* + * trak_control - set fudge factors, return statistics + */ +static void +trak_control(unit, in, out) + u_int unit; + struct refclockstat *in; + struct refclockstat *out; +{ + register struct gpsunit *gps; + + if (unit >= MAXUNITS) { + syslog(LOG_ERR, "trak_control: unit %d invalid", unit); + return; + } + + if (in != 0) { + if (in->haveflags & CLK_HAVETIME1) + fudgefactor[unit] = in->fudgetime1; + if (in->haveflags & CLK_HAVEVAL1) { + stratumtouse[unit] = (u_char)(in->fudgeval1 & 0xf); + if (unitinuse[unit]) { + struct peer *peer; + + /* + * Should actually reselect clock, but + * will wait for the next timecode + */ + gps = gpsunits[unit]; + peer = gps->peer; + peer->stratum = stratumtouse[unit]; + if (stratumtouse[unit] <= 1) + bcopy(GPSREFID, (char *)&peer->refid, + 4); + else + peer->refid = htonl(GPSHSREFID); + } + } + } + + if (out != 0) { + out->type = REFCLK_GPS_TRAK; + out->haveflags + = CLK_HAVETIME1|CLK_HAVEVAL1|CLK_HAVEVAL2; + out->clockdesc = GPSDESCRIPTION; + out->fudgetime1 = fudgefactor[unit]; + out->fudgetime2.l_ui = 0; + out->fudgetime2.l_uf = 0; + out->fudgeval1 = (LONG)stratumtouse[unit]; + out->fudgeval2 = 0; + out->flags = sloppyclockflag[unit]; + if (unitinuse[unit]) { + gps = gpsunits[unit]; + out->lencode = gps->lencode; /* LENTOC */; + out->lastcode = gps->lastcode; + out->timereset = current_time - gps->timestarted; + out->polls = gps->polls; + out->noresponse = gps->noreply; + out->badformat = gps->badformat; + out->baddata = gps->baddata; + out->lastevent = gps->lastevent; + out->currentstatus = gps->status; + } else { + out->lencode = 0; + out->lastcode = ""; + out->polls = out->noresponse = 0; + out->badformat = out->baddata = 0; + out->timereset = 0; + out->currentstatus = out->lastevent = CEVNT_NOMINAL; + } + } +} + +/* + * trak_buginfo - return clock dependent debugging info + */ +static void +trak_buginfo(unit, bug) + int unit; + register struct refclockbug *bug; +{ + register struct gpsunit *gps; + + if (unit >= MAXUNITS) { + syslog(LOG_ERR, "trak_buginfo: unit %d invalid", unit); + return; + } + + if (!unitinuse[unit]) + return; + gps = gpsunits[unit]; + + bug->nvalues = 10; + bug->ntimes = 5; + if (gps->lasttime != 0) + bug->values[0] = current_time - gps->lasttime; + else + bug->values[0] = 0; + bug->values[1] = (U_LONG)gps->reason; + bug->values[2] = (U_LONG)gps->year; + bug->values[3] = (U_LONG)gps->day; + bug->values[4] = (U_LONG)gps->hour; + bug->values[5] = (U_LONG)gps->minute; + bug->values[6] = (U_LONG)gps->second; + bug->values[7] = (U_LONG)gps->msec; + bug->values[8] = gps->noreply; + bug->values[9] = gps->yearstart; + bug->stimes = 0x1c; + bug->times[0] = gps->lastref; + bug->times[1] = gps->lastrec; + bug->times[2] = gps->offset[0]; + bug->times[3] = gps->offset[1]; + bug->times[4] = gps->offset[2]; +} +#endif diff --git a/contrib/xntpd/xntpdc/ntpdc.c b/contrib/xntpd/xntpdc/ntpdc.c index 001bd77c1e55..3113c9ff7817 100644 --- a/contrib/xntpd/xntpdc/ntpdc.c +++ b/contrib/xntpd/xntpdc/ntpdc.c @@ -53,7 +53,7 @@ static int findcmd P((char *, struct xcmd *, struct xcmd *, struct xcmd **)); static int getarg P((char *, int, arg_v *)); static int getnetnum P((char *, U_LONG *, char *)); static void help P((struct parse *, FILE *)); -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) static int helpsort P((const void *, const void *)); #else static int helpsort P((char **, char **)); @@ -598,8 +598,12 @@ again: /* * So far, so good. Copy this data into the output array. */ - if ((datap + datasize) > (pktdata + pktdatasize)) + if ((datap + datasize) > (pktdata + pktdatasize)) { + int offset = datap - pktdata; growpktdata(); + *rdata = pktdata; /* might have been realloced ! */ + datap = pktdata + offset; + } memmove(datap, (char *)rpkt.data, datasize); datap += datasize; if (firstpkt) { @@ -1149,7 +1153,7 @@ help(pcmd, fp) for (xcp = opcmds; xcp->keyword != 0; xcp++) cmdsort[n++] = xcp->keyword; -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) qsort((void *)cmdsort, n, sizeof(char *), helpsort); #else qsort((char *)cmdsort, n, sizeof(char *), helpsort); @@ -1195,7 +1199,7 @@ help(pcmd, fp) * helpsort - do hostname qsort comparisons */ static int -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) helpsort(t1, t2) const void *t1; const void *t2; diff --git a/contrib/xntpd/xntpdc/ntpdc_ops.c b/contrib/xntpd/xntpdc/ntpdc_ops.c index 55483faeba10..4fa9324784cc 100644 --- a/contrib/xntpd/xntpdc/ntpdc_ops.c +++ b/contrib/xntpd/xntpdc/ntpdc_ops.c @@ -66,10 +66,9 @@ static void ctlstats P((struct parse *, FILE *)); static void leapinfo P((struct parse *, FILE *)); static void clockstat P((struct parse *, FILE *)); static void fudge P((struct parse *, FILE *)); -static void maxskew P((struct parse *, FILE *)); static void clkbug P((struct parse *, FILE *)); static void setprecision P((struct parse *, FILE *)); -static void setselect P((struct parse *, FILE *)); +static void kerninfo P((struct parse *, FILE *)); /* * Commands we understand. Ntpdc imports this. @@ -77,37 +76,37 @@ static void setselect P((struct parse *, FILE *)); struct xcmd opcmds[] = { { "listpeers", peerlist, { NO, NO, NO, NO }, { "", "", "", "" }, - "print list of peers the server knows about" }, + "display list of peers the server knows about" }, { "peers", peers, { NO, NO, NO, NO }, { "", "", "", "" }, - "print peer summary information" }, + "display peer summary information" }, { "dmpeers", dmpeers, { NO, NO, NO, NO }, { "", "", "", "" }, - "print peer summary info the way Dave Mills likes it" }, + "display peer summary info the way Dave Mills likes it" }, { "showpeer", showpeer, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, - "print detailed information for one or more peers" }, + "display detailed information for one or more peers" }, { "pstats", peerstats, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, - "print statistical information for one or more peers" }, + "display statistical information for one or more peers" }, { "loopinfo", loopinfo, { OPT|STR, NO, NO, NO }, { "oneline|multiline", "", "", "" }, - "print loop filter information" }, + "display loop filter information" }, { "sysinfo", sysinfo, { NO, NO, NO, NO }, { "", "", "", "" }, - "print local server information" }, + "display local server information" }, { "sysstats", sysstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print local server statistics" }, + "display local server statistics" }, { "memstats", memstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print peer memory usage statistics" }, + "display peer memory usage statistics" }, { "iostats", iostats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print I/O subsystem statistics" }, + "display I/O subsystem statistics" }, { "timerstats", timerstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "print event timer subsystem statistics" }, + "display event timer subsystem statistics" }, { "addpeer", addpeer, { ADD, OPT|UINT, OPT|UINT, OPT|STR }, { "addr", "keyid", "version", "minpoll|prefer" }, "configure a new peer association" }, @@ -121,14 +120,14 @@ struct xcmd opcmds[] = { { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "unconfigure existing peer assocations" }, { "set", set, { STR, OPT|STR, OPT|STR, OPT|STR }, - { "bclient|auth", "...", "...", "..." }, - "set a system flag (bclient, authenticate)" }, + { "bclient|mclient|auth", "...", "...", "..." }, + "set a system flag (bclient, mclient, auth)" }, { "clear", sys_clear, { STR, OPT|STR, OPT|STR, OPT|STR }, - { "bclient|auth", "...", "...", "..." }, - "clear a system flag (bclient, authenticate)" }, + { "bclient|mclient|auth", "...", "...", "..." }, + "clear a system flag (bclient, mclient, auth)" }, { "reslist", reslist, { NO, NO, NO, NO }, { "", "", "", "" }, - "print the server's restrict list" }, + "display the server's restrict list" }, { "restrict", restrict, { ADD, ADD, STR, OPT|STR }, { "address", "mask", "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer", @@ -144,7 +143,7 @@ struct xcmd opcmds[] = { "delete a restrict entry" }, { "monlist", monlist, { NO, NO, NO, NO }, { "", "", "", "" }, - "print data the server's monitor routines have collected" }, + "display data the server's monitor routines have collected" }, { "monitor", monitor, { STR, NO, NO, NO }, { "on|off", "", "", "" }, "turn the server's monitoring facility on or off" }, @@ -171,10 +170,10 @@ struct xcmd opcmds[] = { "remove one or more key ID's from the trusted list" }, { "authinfo", authinfo, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain information concerning the state of the authentication code" }, + "display the state of the authentication code" }, { "traps", traps, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain information about traps set in server" }, + "display the traps set in the server" }, { "addtrap", addtrap, { ADD, OPT|UINT, OPT|ADD, NO }, { "address", "port", "interface", "" }, "configure a trap in the server" }, @@ -189,28 +188,26 @@ struct xcmd opcmds[] = { "change the keyid the server uses to authenticate control messages" }, { "ctlstats", ctlstats, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain packet count statistics from the control module" }, + "display packet count statistics from the control module" }, { "leapinfo", leapinfo, { NO, NO, NO, NO }, { "", "", "", "" }, - "obtain information about the current leap second state" }, + "display the current leap second state" }, { "clockstat", clockstat, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "address", "address", "address", "address" }, - "obtain status information about the specified clock" }, + "display clock status information" }, { "fudge", fudge, { ADD, STR, STR, NO }, { "address", "time1|time2|val1|val2|flags", "value", "" }, "set/change one of a clock's fudge factors" }, - { "maxskew", maxskew, { STR, NO, NO, NO }, - { "maximum_skew", "", "", "" }, - "set the server's maximum skew parameter" }, { "clkbug", clkbug, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, { "address", "address", "address", "address" }, - "obtain debugging information from the specified clock" }, + "display clock debugging information" }, { "setprecision", setprecision, { INT, NO, NO, NO }, { "sys_precision", "", "", "" }, "set the server's advertised precision" }, - { "setselect", setselect, { UINT, NO, NO, NO }, - { "select_algorithm_number", "", "", "" }, - "change the selection weighting algorithm used by the server" }, + { "kerninfo", kerninfo, { NO, NO, NO, NO }, + { "", "", "", "" }, + "display the kernel pll/pps variables" }, + { 0, 0, { NO, NO, NO, NO }, { "", "", "", "" }, "" } }; @@ -374,9 +371,9 @@ dopeers(pcmd, fp, dmstyle) return; (void) fprintf(fp, - " remote local st poll reach delay offset disp\n"); + " remote local st poll reach delay offset disp\n"); (void) fprintf(fp, - "======================================================================\n"); + "=======================================================================\n"); while (items > 0) { if (!dmstyle) { if (plist->flags & INFO_FLAG_SYSPEER) @@ -407,13 +404,14 @@ dopeers(pcmd, fp, dmstyle) ntp_poll = 1<ppoll, plist->hpoll, NTP_MAXPOLL), NTP_MINPOLL); (void) fprintf(fp, - "%c%-15.15s %-15.15s %2d %4d %3o %7.7s %9.9s %6.6s\n", + "%c%-15.15s %-15.15s %2d %4d %3o %7.7s %9.9s %7.7s\n", c, nntohost(plist->srcadr), numtoa(plist->dstadr), plist->stratum, ntp_poll, plist->reach, - fptoa(NTOHS_FP(plist->delay), 4), + fptoa(NTOHS_FP(plist->delay), 5), lfptoa(&tempts, 6), - ufptoa(NTOHS_FP(plist->dispersion), 4)); + ufptoa(NTOHS_FP(plist->dispersion), 5)); + plist++; items--; } @@ -451,16 +449,19 @@ printpeer(pp, fp) "leap %c%c, refid [%s], rootdistance %s, rootdispersion %s\n", pp->leap & 0x2 ? '1' : '0', pp->leap & 0x1 ? '1' : '0', - str, ufptoa(HTONS_FP(pp->rootdelay), 4), - ufptoa(HTONS_FP(pp->rootdispersion), 4)); + str, ufptoa(HTONS_FP(pp->rootdelay), 5), + ufptoa(HTONS_FP(pp->rootdispersion), 5)); (void) fprintf(fp, "ppoll %d, hpoll %d, keyid %u, version %d, association %u\n", pp->ppoll, pp->hpoll, pp->keyid, pp->version, ntohs(pp->associd)); (void) fprintf(fp, - "valid %d, reach %03o, unreach %d, trust %03o\n", - pp->valid, pp->reach, pp->unreach, pp->trust); + "valid %d, reach %03o, unreach %d, flash %03o, ", + pp->valid, pp->reach, pp->unreach, pp->flash); + + (void) fprintf(fp, "estbdelay %s, ttl %d\n", + mfptoa(0, ntohl(pp->estbdelay), 5), pp->ttl); (void) fprintf(fp, "timer %ds, flags", ntohl(pp->timer)); if (pp->flags == 0) { @@ -508,7 +509,8 @@ printpeer(pp, fp) (void) fprintf(fp, "filter delay: "); for (i = 0; i < NTP_SHIFT; i++) { - (void) fprintf(fp, " %-8.8s", fptoa(HTONS_FP(pp->filtdelay[i]),4)); + (void) fprintf(fp, " %-8.8s", + fptoa(HTONS_FP(pp->filtdelay[i]), 5)); if (i == (NTP_SHIFT>>1)-1) (void) fprintf(fp, "\n "); } @@ -517,7 +519,7 @@ printpeer(pp, fp) (void) fprintf(fp, "filter offset:"); for (i = 0; i < NTP_SHIFT; i++) { HTONL_FP(&pp->filtoffset[i], &tempts); - (void) fprintf(fp, " %-8.8s", lfptoa(&tempts, 5)); + (void) fprintf(fp, " %-8.8s", lfptoa(&tempts, 6)); if (i == (NTP_SHIFT>>1)-1) (void) fprintf(fp, "\n "); } @@ -531,23 +533,13 @@ printpeer(pp, fp) } (void) fprintf(fp, "\n"); - (void) fprintf(fp, "bdelay filter:"); - for (i = 0; i < NTP_SHIFT; i++) { - (void) fprintf(fp, " %-8.8s", - mfptoa(0, ntohl(pp->bdelay[i]), 5)); - if (i == (NTP_SHIFT>>1)-1) - (void) fprintf(fp, "\n "); - } - (void) fprintf(fp, "\n"); - - (void) fprintf(fp, "delay %s, estbdelay %s\n", - fptoa(HTONS_FP(pp->delay), 4), - mfptoa(0, ntohl(pp->estbdelay), 4)); HTONL_FP(&pp->offset, &tempts); - (void) fprintf(fp, "offset %s, dispersion %s\n", - lfptoa(&tempts, 6), - ufptoa(HTONS_FP(pp->dispersion), 4)); + (void) fprintf(fp, + "offset %s, delay %s, dispersion %s, selectdisp %s\n", + lfptoa(&tempts, 6), fptoa(HTONS_FP(pp->delay), 5), + ufptoa(HTONS_FP(pp->dispersion), 5), + ufptoa(HTONS_FP(pp->selectdisp), 5)); } @@ -781,11 +773,10 @@ sysinfo(pcmd, fp) is->leap & 0x1 ? '1' : '0'); (void) fprintf(fp, "stratum: %d\n", (int)is->stratum); (void) fprintf(fp, "precision: %d\n", (int)is->precision); - (void) fprintf(fp, "select algorithm: %d\n", (int)is->selection); (void) fprintf(fp, "sync distance: %s\n", - fptoa(NTOHS_FP(is->rootdelay), 4)); + fptoa(NTOHS_FP(is->rootdelay), 5)); (void) fprintf(fp, "sync dispersion: %s\n", - ufptoa(NTOHS_FP(is->rootdispersion), 4)); + ufptoa(NTOHS_FP(is->rootdispersion), 5)); if (is->stratum <= 1) { junk[4] = 0; memmove(junk, (char *)&is->refid, 4); @@ -799,7 +790,8 @@ sysinfo(pcmd, fp) (void) fprintf(fp, "reference time: %s\n", prettydate(&tempts)); (void) fprintf(fp, "system flags: "); - if ((is->flags & (INFO_FLAG_BCLIENT|INFO_FLAG_AUTHENABLE)) == 0) { + if ((is->flags & (INFO_FLAG_BCLIENT | INFO_FLAG_MCLIENT | + INFO_FLAG_AUTHENABLE)) == 0) { (void) fprintf(fp, "none\n"); } else { res = 0; @@ -807,6 +799,10 @@ sysinfo(pcmd, fp) (void) fprintf(fp, "bclient"); res = 1; } + if (is->flags & INFO_FLAG_MCLIENT) { + (void) fprintf(fp, "mclient"); + res = 1; + } if (is->flags & INFO_FLAG_AUTHENABLE) (void) fprintf(fp, "%sauthenticate", res ? ", " : ""); @@ -818,8 +814,6 @@ sysinfo(pcmd, fp) HTONL_FP(&is->authdelay, &tempts); (void) fprintf(fp, "encryption delay: %s\n", lfptoa(&tempts, 7)); - (void) fprintf(fp, "maximum skew: %s\n", - ufptoa(NTOHS_FP(is->maxskew), 4)); } @@ -846,8 +840,12 @@ sysstats(pcmd, fp) if (!check1item(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_sys_stats))) + if (itemsize != sizeof(struct info_sys_stats) && + itemsize != sizeof(struct old_info_sys_stats)) { + /* issue warning according to new structure size */ + checkitemsize(itemsize, sizeof(struct info_sys_stats)); return; + } (void) fprintf(fp, "system uptime: %d\n", ntohl(ss->timeup)); @@ -867,8 +865,11 @@ sysstats(pcmd, fp) ntohl(ss->processed)); (void) fprintf(fp, "bad authentication: %d\n", ntohl(ss->badauth)); - (void) fprintf(fp, "wander hold downs: %d\n", - ntohl(ss->wanderhold)); + if (itemsize != sizeof(struct info_sys_stats)) + return; + + (void) fprintf(fp, "limitation rejects: %d\n", + ntohl(ss->limitrejected)); } @@ -1205,6 +1206,8 @@ doset(pcmd, fp, req) for (items = 0; items < pcmd->nargs; items++) { if (STREQ(pcmd->argval[items].string, "bclient")) sys.flags |= SYS_FLAG_BCLIENT; + else if (STREQ(pcmd->argval[items].string, "mclient")) + sys.flags |= SYS_FLAG_MCLIENT; else if (STREQ(pcmd->argval[items].string, "auth")) sys.flags |= SYS_FLAG_AUTHENTICATE; else { @@ -1243,6 +1246,7 @@ static struct resflags resflags[] = { { "nopeer", RES_NOPEER }, { "notrap", RES_NOTRAP }, { "lptrap", RES_LPTRAP }, + { "limited", RES_LIMITED }, { "", 0 } }; @@ -1463,6 +1467,7 @@ monlist(pcmd, fp) FILE *fp; { struct info_monitor *ml; + struct old_info_monitor *oml; int items; int itemsize; int res; @@ -1476,23 +1481,49 @@ monlist(pcmd, fp) if (!checkitems(items, fp)) return; - if (!checkitemsize(itemsize, sizeof(struct info_monitor))) - return; + if (itemsize == sizeof(struct info_monitor)) { - (void) fprintf(fp, - " address port count mode version lasttime firsttime\n"); - (void) fprintf(fp, - "=====================================================================\n"); - while (items > 0) { - (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u\n", - nntohost(ml->addr), - ntohs(ml->port), - ntohl(ml->count), - ml->mode, ml->version, - ntohl(ml->lasttime), - ntohl(ml->firsttime)); - ml++; - items--; + (void) fprintf(fp, + " address port count mode version lastdrop lasttime firsttime\n"); + (void) fprintf(fp, + "===============================================================================\n"); + while (items > 0) { + (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u %9u\n", + nntohost(ml->addr), + ntohs(ml->port), + ntohl(ml->count), + ml->mode, + ml->version, + ntohl(ml->lastdrop), + ntohl(ml->lasttime), + ntohl(ml->firsttime)); + ml++; + items--; + } + } else { + if (itemsize != sizeof(struct old_info_monitor)) { + /* issue warning according to new info_monitor size */ + checkitemsize(itemsize, sizeof(struct info_monitor)); + return; + } + + oml = (struct old_info_monitor *)ml; + (void) fprintf(fp, + " address port count mode version lasttime firsttime\n"); + (void) fprintf(fp, + "======================================================================\n"); + while (items > 0) { + (void) fprintf(fp, "%-20.20s %5d %9d %4d %3d %9u %9u\n", + nntohost(oml->addr), + ntohs(oml->port), + ntohl(oml->count), + oml->mode, + oml->version, + ntohl(oml->lasttime), + ntohl(oml->firsttime)); + oml++; + items--; + } } } @@ -2247,39 +2278,6 @@ fudge(pcmd, fp) return; } - - -/* - * maxskew - set the server's maximum skew parameter - */ -static void -maxskew(pcmd, fp) - struct parse *pcmd; - FILE *fp; -{ - u_fp Xmaxskew; - l_fp tmp; - int items; - int itemsize; - char *dummy; - int res; - - if (!atolfp(pcmd->argval[0].string, &tmp)) { - (void) fprintf(stderr, "What the heck does %s mean?\n", - pcmd->argval[0].string); - return; - } - Xmaxskew = HTONS_FP(LFPTOFP(&tmp)); - - res = doquery(IMPL_XNTPD, REQ_SET_MAXSKEW, 1, 1, sizeof(u_fp), - (char *)&Xmaxskew, &items, &itemsize, &dummy); - - if (res == 0) - (void) fprintf(fp, "done!\n"); -} - - - /* * clkbug - get and print clock debugging information */ @@ -2395,27 +2393,72 @@ setprecision(pcmd, fp) } - /* - * setselect - change the server's selection algorithm + * kerninfo - display the kernel pll/pps variables */ static void -setselect(pcmd, fp) +kerninfo(pcmd, fp) struct parse *pcmd; FILE *fp; { - U_LONG select_code; + struct info_kernel *ik; int items; int itemsize; - char *dummy; int res; - select_code = htonl(pcmd->argval[0].uval); + res = doquery(IMPL_XNTPD, REQ_GET_KERNEL, 0, 0, 0, (char *)NULL, + &items, &itemsize, (char **)&ik); + if (res != 0 && items == 0) + return; + if (!check1item(items, fp)) + return; + if (!checkitemsize(itemsize, sizeof(struct info_kernel))) + return; - res = doquery(IMPL_XNTPD, REQ_SET_SELECT_CODE, 1, 1, sizeof(U_LONG), - (char *)&select_code, &items, &itemsize, &dummy); - - if (res == 0) - (void) fprintf(fp, "done!\n"); - return; + /* + * pll variables + */ + (void)fprintf(fp, "pll offset: %d us\n", + ntohl(ik->offset)); + (void)fprintf(fp, "pll frequency: %s ppm\n", + fptoa((s_fp)ntohl(ik->freq), 3)); + (void)fprintf(fp, "maximum error: %d us\n", + ntohl(ik->maxerror)); + (void)fprintf(fp, "estimated error: %d us\n", + ntohl(ik->esterror)); + (void)fprintf(fp, "status: %04x\n", + ntohs(ik->status & 0xffff)); + (void)fprintf(fp, "pll time constant: %d\n", + ntohl(ik->constant)); + (void)fprintf(fp, "precision: %d us\n", + ntohl(ik->precision)); + (void)fprintf(fp, "frequency tolerance: %s ppm\n", + fptoa((s_fp)ntohl(ik->tolerance), 0)); + + /* + * For backwards compatibility (ugh), we find the pps variables + * only if the shift member is nonzero. + */ + if (!ik->shift) + return; + + /* + * pps variables + */ + (void)fprintf(fp, "pps frequency: %s ppm\n", + fptoa((s_fp)ntohl(ik->ppsfreq), 3)); + (void)fprintf(fp, "pps stability: %s ppm\n", + fptoa((s_fp)ntohl(ik->stabil), 3)); + (void)fprintf(fp, "pps jitter: %d us\n", + ntohl(ik->jitter)); + (void)fprintf(fp, "calibration interval: %d s\n", + 1 << ntohs(ik->shift)); + (void)fprintf(fp, "calibration cycles: %d\n", + ntohl(ik->calcnt)); + (void)fprintf(fp, "jitter exceeded: %d\n", + ntohl(ik->jitcnt)); + (void)fprintf(fp, "stability exceeded: %d\n", + ntohl(ik->stbcnt)); + (void)fprintf(fp, "calibration errors: %d\n", + ntohl(ik->errcnt)); } diff --git a/contrib/xntpd/xntpres/xntpres.c b/contrib/xntpd/xntpres/xntpres.c index ee88b1f3be98..47c6eda7dc12 100644 --- a/contrib/xntpd/xntpres/xntpres.c +++ b/contrib/xntpd/xntpres/xntpres.c @@ -46,6 +46,7 @@ struct conf_entry { #define ce_minpoll ce_config.minpoll #define ce_maxpoll ce_config.maxpoll #define ce_flags ce_config.flags +#define ce_ttl ce_config.ttl #define ce_keyid ce_config.keyid /* @@ -100,8 +101,9 @@ int resolve_value; /* next value of resolve timer */ #define TOK_MINPOLL 3 #define TOK_MAXPOLL 4 #define TOK_FLAGS 5 -#define TOK_KEYID 6 -#define NUMTOK 7 +#define TOK_TTL 6 +#define TOK_KEYID 7 +#define NUMTOK 8 #define MAXLINESIZE 512 @@ -128,7 +130,7 @@ extern int errno; static RETSIGTYPE bong P((int)); static void checkparent P((void)); static void removeentry P((struct conf_entry *)); -static void addentry P((char *, int, int, int, int, int, U_LONG)); +static void addentry P((char *, int, int, int, int, int, int, U_LONG)); static int findhostaddr P((struct conf_entry *)); static void openntp P((void)); static int request P((struct conf_peer *)); @@ -338,13 +340,14 @@ removeentry(entry) * addentry - add an entry to the configuration list */ static void -addentry(name, mode, version, minpoll, maxpoll, flags, keyid) +addentry(name, mode, version, minpoll, maxpoll, flags, ttl, keyid) char *name; int mode; int version; int minpoll; int maxpoll; int flags; + int ttl; U_LONG keyid; { register char *cp; @@ -363,6 +366,7 @@ addentry(name, mode, version, minpoll, maxpoll, flags, keyid) ce->ce_minpoll = (u_char)minpoll; ce->ce_maxpoll = (u_char)maxpoll; ce->ce_flags = (u_char)flags; + ce->ce_ttl = (u_char)ttl; ce->ce_keyid = htonl(keyid); ce->ce_next = NULL; @@ -802,9 +806,9 @@ readconf(fp, name) * This is as good as we can check it. Add it in. */ addentry(token[TOK_HOSTNAME], (int)intval[TOK_HMODE], - (int)intval[TOK_VERSION], - (int)intval[TOK_MINPOLL], (int)intval[TOK_MAXPOLL], - flags, intval[TOK_KEYID]); + (int)intval[TOK_VERSION], (int)intval[TOK_MINPOLL], + (int)intval[TOK_MAXPOLL], flags, (int)intval[TOK_TTL], + intval[TOK_KEYID]); } } diff --git a/etc/Makefile b/etc/Makefile index 9b4b804c2471..f67591f79ddf 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,7 +1,5 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 -# $Id: Makefile,v 1.53.2.5 1994/05/03 10:08:21 rgrimes Exp $ - -NOOBJ= noobj +# $Id: Makefile,v 1.76 1994/06/29 21:19:38 jkh Exp $ # disktab may be wrong -- hcx9 is a tahoe, but gets its own. # -rw-r--r-- @@ -9,16 +7,23 @@ BINOWN= root BINGRP= wheel BIN1= aliases csh.cshrc csh.login csh.logout dm.conf \ ftpusers gettytab group hosts host.conf hosts.equiv hosts.lpd \ - inetd.conf motd myname netstart networks phones \ - printcap protocols rc rc.local remote security services shells \ - syslog.conf ttys etc.${MACHINE}/disktab rpc + inetd.conf login.access motd myname netstart \ + networks phones printcap protocols rc rc.local remote \ + security services shells skey.access \ + syslog.conf ttys etc.${MACHINE}/disktab rpc make.conf \ + ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config \ + ${.CURDIR}/../usr.bin/mail/misc/mail.rc # -rw-rw-rw- BIN2= motd -# -rwxr-xr-x root.wheel, for the new f***ing cron root.wheel +# -rwxr-xr-x root.wheel, for the new cron root.wheel BIN3= daily weekly monthly +CLEANFILES+= *.o *.lo *.c *.cache *.mk kcopy filesystem + +ZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 - + MTREE= BSD.local.dist BSD.root.dist BSD.usr.dist BSD.var.dist NAMEDB= localhost.rev named.boot root.cache PCS= pcs750.bin @@ -27,14 +32,14 @@ WCS2= fpevent fppwcs fppwcs_dual hdcwcs load_diags start_fpp wcs wcs_dual # Special top level files for FreeBSD COPYRIGHT= COPYRIGHT.386BSD COPYRIGHT.FreeBSD -FREEBSD= CONTRIB.386BSD CONTRIB.FreeBSD +FREEBSD= CONTRIB.386BSD CONTRIB.FreeBSD ROSTER.FreeBSD FREEBSD+= MIRROR.SITES PERSONAL.ACKS RELNOTES.FreeBSD SUPPORT.TXT FREEBSD+= ${COPYRIGHT} # # Floppy drive name and files for building FreeBSD Floppies FLOPPY?= fd0 MOUNT?= /mnt -FLOPPY_TYPE?= fd1200 +FLOPPY_TYPE?= fd1440 # MDEC= usr/mdec/bootfd usr/mdec/fdboot MDEC+= usr/mdec/bootsd usr/mdec/sdboot @@ -42,10 +47,9 @@ MDEC+= usr/mdec/bootwd usr/mdec/wdboot # KC_DIRS= bin dev mnt sbin KC_FILES= ${COPYRIGHT} -KC_FILES+= bin/sh # XXX Crunch is broken! -KC_FILES+= sbin/mount sbin/mount_isofs # XXX Crunch is broken! -KC_LINKS= bin/[ bin/cp bin/echo bin/test +KC_LINKS= bin/[ bin/cp bin/echo bin/sh bin/test KC_LINKS+= sbin/fsck sbin/halt sbin/init +KC_LINKS+= sbin/mount sbin/mount_isofs KC_LINKS+= sbin/umount # CD_DIRS= etc usr @@ -53,13 +57,12 @@ CD_DIRS= etc usr FILESYSTEM_DIRS= bin dev etc mnt proc sbin usr usr/bin usr/mdec usr/sbin FILESYSTEM_TREES= dev FILESYSTEM_FILES= ${COPYRIGHT} -FILESYSTEM_FILES+= bin/sh # XXX Crunch is broken! FILESYSTEM_FILES+= dev/MAKEDEV FILESYSTEM_FILES+= etc/group FILESYSTEM_FILES+= etc/master.passwd etc/passwd etc/pwd.db FILESYSTEM_FILES+= ${MDEC} FILESYSTEM_LINKS= bin/[ bin/expr bin/ls bin/mkdir bin/rm -FILESYSTEM_LINKS+= bin/sync bin/test +FILESYSTEM_LINKS+= bin/sh bin/sync bin/test FILESYSTEM_LINKS+= sbin/disklabel sbin/fdisk sbin/halt sbin/init FILESYSTEM_LINKS+= sbin/mount sbin/mount_pcfs FILESYSTEM_LINKS+= sbin/newfs @@ -92,13 +95,13 @@ CPIO_CPIO+= usr/bin/awk usr/bin/chgrp usr/bin/cpio usr/bin/ex usr/bin/ftp CPIO_CPIO+= usr/bin/gunzip usr/bin/gzcat usr/bin/gzip CPIO_CPIO+= usr/bin/more usr/bin/tar usr/bin/tip CPIO_CPIO+= usr/bin/vi usr/bin/view usr/bin/zcat -CPIO_CPIO+= usr/lib/libc.so.1.0 -CPIO_CPIO+= usr/lib/libcurses.so.1.0 -CPIO_CPIO+= usr/lib/libgcc.so.1.0 -CPIO_CPIO+= usr/lib/libm.so.1.0 -CPIO_CPIO+= usr/lib/libtermlib.so.1.0 -CPIO_CPIO+= usr/lib/libtermcap.so.1.0 -CPIO_CPIO+= usr/lib/libutil.so.1.0 +CPIO_CPIO+= usr/lib/libc.so.1.1 +CPIO_CPIO+= usr/lib/libcurses.so.1.1 +CPIO_CPIO+= usr/lib/libgcc.so.1.1 +CPIO_CPIO+= usr/lib/libm.so.1.1 +CPIO_CPIO+= usr/lib/libtermlib.so.1.1 +CPIO_CPIO+= usr/lib/libtermcap.so.1.1 +CPIO_CPIO+= usr/lib/libutil.so.1.1 CPIO_CPIO+= usr/libexec/ld.so CPIO_CPIO+= usr/sbin/bad144 usr/sbin/chown CPIO_CPIO+= usr/share/misc/termcap @@ -114,10 +117,10 @@ CRYPT_SRCS+= usr.bin/bdes usr.bin/lock usr.bin/login usr.bin/passwd CRYPT_SRCS+= usr.bin/rlogin usr.bin/rsh usr.bin/su usr.bin/telnet CRYPT_DIRS= bin sbin usr usr/bin usr/lib usr/libexec -all clean cleandir depend etc install lint: +all depend etc install lint: crypt: - rm -f ${LIBCRYPT}; + rm -f /usr/lib/libcrypt* (cd ${.CURDIR}/../${CRYPT_LIB}; \ ${MAKE} cleandir obj depend all install) for i in ${CRYPT_SRCS}; do \ @@ -126,41 +129,44 @@ crypt: done non-crypt: - rm -f ${LIBCRYPT} + rm -f /usr/lib/libcrypt* for i in ${CRYPT_SRCS}; do \ cd ${.CURDIR}/../$$i; \ ${MAKE} cleandir obj depend all; \ done distribution: distrib-dirs - install -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc - install -c -o ${BINOWN} -g ${BINGRP} -m 666 ${BIN2} ${DESTDIR}/etc - install -c -o root -g wheel -m 755 ${BIN3} ${DESTDIR}/etc - install -c -o root -g wheel -m 644 crontab ${DESTDIR}/etc - install -c -o root -g wheel -m 600 /dev/null ${DESTDIR}/var/cron/log - install -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc - pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd + (cd ${.CURDIR}; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 666 ${BIN2} ${DESTDIR}/etc; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 ${BIN3} ${DESTDIR}/etc; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 644 crontab ${DESTDIR}/etc; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ + ${DESTDIR}/var/cron/log; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 600 \ + master.passwd ${DESTDIR}/etc; \ + pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd; \ install -c -o ${BINOWN} -g ${BINGRP} -m 555 \ - MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev + MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev ) .if defined(CDROMDIST) - (cd ${DESTDIR}/dev; sh MAKEDEV all) + (cd ${DESTDIR}/dev; sh MAKEDEV all) ; .endif - (cd root; \ - install -c -o root -g wheel -m 644 dot.cshrc \ + (cd ${.CURDIR}/root; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.cshrc \ ${DESTDIR}/root/.cshrc; \ - install -c -o root -g wheel -m 644 dot.klogin \ + install -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.klogin \ ${DESTDIR}/root/.klogin; \ - install -c -o root -g wheel -m 644 dot.login \ + install -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.login \ ${DESTDIR}/root/.login; \ - install -c -o root -g wheel -m 644 dot.profile \ + install -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.profile \ ${DESTDIR}/root/.profile; \ rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \ ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile) - cd mtree; install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${MTREE} \ - ${DESTDIR}/etc/mtree - cd namedb; install -c -o ${BINOWN} -g ${BINGRP} -m 644 ${NAMEDB} \ - ${DESTDIR}/etc/namedb + cd ${.CURDIR}/mtree; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${MTREE} ${DESTDIR}/etc/mtree + cd ${.CURDIR}/namedb; install -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${NAMEDB} ${DESTDIR}/etc/namedb install -c -o ${BINOWN} -g operator -m 664 /dev/null \ ${DESTDIR}/etc/dumpdates install -c -o nobody -g ${BINGRP} -m 664 /dev/null \ @@ -177,56 +183,75 @@ distribution: distrib-dirs ${DESTDIR}/var/log/wtmp install -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ ${DESTDIR}/var/run/utmp - (cd etc.${MACHINE}; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ - fstab.* ${DESTDIR}/etc) + install -c -o ${BINOWN} -g ${BINGRP} -m 664 ${.CURDIR}/minfree \ + ${DESTDIR}/var/crash + (cd ${.CURDIR}/etc.${MACHINE}; install -c -o ${BINOWN} -g ${BINGRP} \ + -m 444 fstab.* ${DESTDIR}/etc) .if defined(NOCRYPT) - ${MAKE} non-crypt - (cd ..; NOCRYPT=nocrypt; export NOCRYPT; ${MAKE} install) + (cd ${.CURDIR}; ${MAKE} non-crypt) + (cd ${.CURDIR}/..; NOCRYPT=nocrypt; export NOCRYPT; ${MAKE} install) .else - ${MAKE} crypt - (cd ..; ${MAKE} install) + (cd ${.CURDIR}; ${MAKE} crypt) + (cd ${.CURDIR}/..; ${MAKE} install) .endif - (cd ../usr.sbin/sendmail/src; \ + (cd ${.CURDIR}/../usr.sbin/sendmail/src; \ ${MAKE} install; \ cd ../cf/cf; \ ${MAKE} obj; \ ${MAKE} freefall.cf; \ - install -o root -g wheel -m 644 obj/freefall.cf \ + install -o ${BINOWN} -g ${BINGRP} -m 644 obj/freefall.cf \ ${DESTDIR}/etc/sendmail.cf) - (cd ../; \ - install -c -o root -g wheel -m 444 ${FREEBSD} ${DESTDIR}/) - (cd ..; ${MAKE} mdec; ) - (cd ../share/man; ${MAKE} makedb; ) + (cd ${.CURDIR}/..; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${FREEBSD} ${DESTDIR}/) + (cd ${.CURDIR}/..; ${MAKE} mdec; ) + (cd ${.CURDIR}/../share/man; ${MAKE} makedb; ) .if ${MACHINE} == "tahoe" - (cd etc.tahoe; install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${WCS1} \ - ${DESTDIR}/) + (cd ${.CURDIR}/etc.tahoe; install -c -o ${BINOWN} -g ${BINGRP} \ + -m 444 ${WCS1} ${DESTDIR}/) .endif .if ${MACHINE} == "vax" - (cd etc.vax; install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${PCS} \ - ${DESTDIR}/) + (cd ${.CURDIR}/etc.vax; install -c -o ${BINOWN} -g ${BINGRP} \ + -m 444 ${PCS} ${DESTDIR}/) .endif -hcx9-distribution: - (cd etc.tahoe; install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${WCS2} \ - ${DESTDIR}/) +crunch: + crunchgen ${.CURDIR}/../contrib/crunch/examples/kcopy.conf + ${MAKE} -f kcopy.mk objs exe + crunchgen ${.CURDIR}/../contrib/crunch/examples/filesystem.conf + ${MAKE} -f filesystem.mk objs exe -kcopy-kernels: ../sys/i386/conf/GENERICAH ../sys/i386/conf/GENERICBT - (cd ../sys/compile; rm -rf GENERICAH GENERICBT) - (cd ../sys/i386/conf; config GENERICAH; config GENERICBT) - (cd ../sys/compile/GENERICAH; ${MAKE} depend; ${MAKE} all; \ - install -c -o root -g wheel -m 755 386bsd \ +extract: + install -c -o ${BINOWN} -g ${BINGRP} -m 555 \ + ${.CURDIR}/etc.i386/EXTRACT_bin.sh \ + ${RELEASEDIR}/tarballs/bindist/EXTRACT.sh + install -c -o ${BINOWN} -g ${BINGRP} -m 555 \ + ${.CURDIR}/etc.i386/EXTRACT_src.sh \ + ${RELEASEDIR}/tarballs/srcdist/EXTRACT.sh + install -c -o ${BINOWN} -g ${BINGRP} -m 555 \ + ${.CURDIR}/etc.i386/EXTRACT_secr.sh \ + ${RELEASEDIR}/tarballs/secrdist/EXTRACT.sh + +hcx9-distribution: + (cd ${.CURDIR}/etc.tahoe; install -c -o ${BINOWN} -g ${BINGRP} \ + -m 444 ${WCS2} ${DESTDIR}/) + +kcopy-kernels: ${.CURDIR}/../sys/i386/conf/GENERICAH ${.CURDIR}/../sys/i386/conf/GENERICBT + (cd ${.CURDIR}/../sys/compile; rm -rf GENERICAH GENERICBT) + (cd ${.CURDIR}/../sys/i386/conf; config GENERICAH; config GENERICBT) + (cd ${.CURDIR}/../sys/compile/GENERICAH; ${MAKE} depend; ${MAKE} all; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 386bsd \ ${DESTDIR}/386bsd.GENERICAH) - (cd ../sys/compile/GENERICBT; ${MAKE} depend; ${MAKE} all; \ - install -c -o root -g wheel -m 755 386bsd \ + (cd ${.CURDIR}/../sys/compile/GENERICBT; ${MAKE} depend; ${MAKE} all; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 386bsd \ ${DESTDIR}/386bsd.GENERICBT) kcopy-floppy: disklabel -w -r ${FLOPPY} ${FLOPPY_TYPE} \ - /usr/mdec/fdboot /usr/mdec/bootfd - newfs -b 4096 -c 80 -f 512 -i 10240 -m 0 -o space \ + ${DESTDIR}/usr/mdec/fdboot ${DESTDIR}/usr/mdec/bootfd + newfs -b 4096 -c 80 -f 512 -i 8192 -m 0 -o space \ r${FLOPPY} ${FLOPPY_TYPE} mount /dev/${FLOPPY} ${MOUNT} - chown root.wheel ${MOUNT}/. + chown ${BINOWN}.${BINGRP} ${MOUNT}/. chmod 755 ${MOUNT}/. (cd ${DESTDIR}/; \ ls -d ${KC_DIRS} | cpio -pdamuv ${MOUNT}) @@ -239,10 +264,10 @@ kcopy-floppy: rm -rf rmcd*) (cd ${DESTDIR}/; \ ls ${KC_FILES} | cpio -pdamuv ${MOUNT}) - install -c -o root -g wheel -m 755 etc.i386/kc.profile \ - ${MOUNT}/.profile - install -c -o root -g wheel -m 755 ${RELEASEDIR}/distbin/kcopy \ - ${MOUNT}/bin/kcopy + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/kc.profile ${MOUNT}/.profile + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + kcopy ${MOUNT}/bin/kcopy (cd ${MOUNT}/; \ for i in ${KC_LINKS}; do \ ln bin/kcopy $$i; \ @@ -250,27 +275,27 @@ kcopy-floppy: kcopy_ah.flp: ${MAKE} kcopy-floppy - (cd ../sys/compile/GENERICAH; \ - install -c -o root -g wheel -m 755 386bsd ${MOUNT}/) + (cd ${.CURDIR}/../sys/compile/GENERICAH; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 386bsd ${MOUNT}/) df -ik ${MOUNT} umount /dev/${FLOPPY} fsck /dev/r${FLOPPY} dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/kcopy_ah.flp \ bs=15b count=160 gzip --no-name -9 -c ${RELEASEDIR}/floppies/kcopy_ah.flp \ - >${RELEASEDIR}/floppies/kcopy_ah.flp.gz + >${RELEASEDIR}/floppies/kcopy_ah.flp.gz & kcopy_bt.flp: ${MAKE} kcopy-floppy - (cd ../sys/compile/GENERICBT; \ - install -c -o root -g wheel -m 755 386bsd ${MOUNT}/) + (cd ${.CURDIR}/../sys/compile/GENERICBT; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 386bsd ${MOUNT}/) df -ik ${MOUNT} umount /dev/${FLOPPY} fsck /dev/r${FLOPPY} dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/kcopy_bt.flp \ bs=15b count=160 gzip --no-name -9 -c ${RELEASEDIR}/floppies/kcopy_bt.flp \ - >${RELEASEDIR}/floppies/kcopy_bt.flp.gz + >${RELEASEDIR}/floppies/kcopy_bt.flp.gz & cdins-floppy: ${MAKE} kcopy-floppy @@ -280,44 +305,44 @@ cdins-floppy: ln -s /cdrom/filesys/usr/libexec libexec; \ ln -s /cdrom/filesys/usr/lib lib) mkdir ${MOUNT}/cdrom - chown root.wheel ${MOUNT}/cdrom + chown ${BINOWN}.${BINGRP} ${MOUNT}/cdrom chmod 755 ${MOUNT}/cdrom - install -c -o root -g wheel -m 755 etc.i386/cdinst1.profile \ - ${MOUNT}/.profile - install -c -o root -g wheel -m 755 etc.i386/cdinst1.install \ - ${MOUNT}/install + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/cdinst1.profile ${MOUNT}/.profile + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/cdinst1.install ${MOUNT}/install cdins_ah.flp: ${MAKE} cdins-floppy - (cd ../sys/compile/GENERICAH; \ - install -c -o root -g wheel -m 755 386bsd ${MOUNT}/) + (cd ${.CURDIR}/../sys/compile/GENERICAH; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 386bsd ${MOUNT}/) df -ik ${MOUNT} umount /dev/${FLOPPY} fsck /dev/r${FLOPPY} dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/cdins_ah.flp \ bs=15b count=160 gzip --no-name -9 -c ${RELEASEDIR}/floppies/cdins_ah.flp \ - >${RELEASEDIR}/floppies/cdins_ah.flp.gz + >${RELEASEDIR}/floppies/cdins_ah.flp.gz & cdins_bt.flp: ${MAKE} cdins-floppy - (cd ../sys/compile/GENERICBT; \ - install -c -o root -g wheel -m 755 386bsd ${MOUNT}/) + (cd ${.CURDIR}/../sys/compile/GENERICBT; \ + install -c -o ${BINOWN} -g ${BINGRP} -m 755 386bsd ${MOUNT}/) df -ik ${MOUNT} umount /dev/${FLOPPY} fsck /dev/r${FLOPPY} dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/cdins_bt.flp \ bs=15b count=160 gzip --no-name -9 -c ${RELEASEDIR}/floppies/cdins_bt.flp \ - >${RELEASEDIR}/floppies/cdins_bt.flp.gz + >${RELEASEDIR}/floppies/cdins_bt.flp.gz & filesyst.flp: disklabel -w -r ${FLOPPY} ${FLOPPY_TYPE} \ - /usr/mdec/fdboot /usr/mdec/bootfd + ${DESTDIR}/usr/mdec/fdboot ${DESTDIR}/usr/mdec/bootfd newfs -b 4096 -c 80 -f 512 -i 10240 -m 0 -o space \ r${FLOPPY} ${FLOPPY_TYPE} mount /dev/${FLOPPY} ${MOUNT} - chown root.wheel ${MOUNT}/. + chown ${BINOWN}.${BINGRP} ${MOUNT}/. chmod 755 ${MOUNT}/. (cd ${DESTDIR}/; \ ls -d ${FILESYSTEM_DIRS} | cpio -pdamuv ${MOUNT}) @@ -331,12 +356,12 @@ filesyst.flp: (find ${FILESYSTEM_CPIO}; ls -d ${FILESYSTEM_CPIO_DIRS}) | \ cpio -H newc --block-size=16 -oav | \ gzip -9 >${MOUNT}/inst1.cpio.gz) - install -c -o root -g wheel -m 755 etc.i386/inst1.profile \ - ${MOUNT}/.profile - install -c -o root -g wheel -m 755 etc.i386/inst1.install \ - ${MOUNT}/install - install -c -o root -g wheel -m 755 ${RELEASEDIR}/distbin/filesystem \ - ${MOUNT}/bin/filesystem + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/inst1.profile ${MOUNT}/.profile + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/inst1.install ${MOUNT}/install + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + filesystem ${MOUNT}/bin/filesystem (cd ${MOUNT}/; \ for i in ${FILESYSTEM_LINKS}; do \ ln bin/filesystem $$i; \ @@ -354,153 +379,150 @@ filesyst.flp: dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/filesyst.flp \ bs=15b count=160 gzip --no-name -9 -c ${RELEASEDIR}/floppies/filesyst.flp \ - >${RELEASEDIR}/floppies/filesyst.flp.gz + >${RELEASEDIR}/floppies/filesyst.flp.gz & cpio.flp: disklabel -w -r ${FLOPPY} ${FLOPPY_TYPE} \ - /usr/mdec/fdboot /usr/mdec/bootfd + ${DESTDIR}/usr/mdec/fdboot ${DESTDIR}/usr/mdec/bootfd newfs -b 4096 -c 80 -f 512 -i 65536 -m 0 -o space \ r${FLOPPY} ${FLOPPY_TYPE} mount /dev/${FLOPPY} ${MOUNT} - chown root.wheel ${MOUNT}/. + chown ${BINOWN}.${BINGRP} ${MOUNT}/. chmod 755 ${MOUNT}/. (cd ${DESTDIR}/; \ ls ${CPIO_FILES} | cpio -pdamuv ${MOUNT}) + # This ugliness is because the default termcap file is simply too + # big and we don't need such a hugh one for the initial installation, + # yet we want the symlink in /etc to point to the right place so we + # need to install the smaller one in the same location. Same goes + # for the elvis hackery; just trying to bum as many bytes as we can + # here, and that's rarely a very pretty process. + mv ${DESTDIR}/usr/share/misc/termcap ${DESTDIR}/usr/share/misc/otermcap + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/termcap.small ${DESTDIR}/usr/share/misc/termcap + # Use cp so we don't destroy the links. + cp ${DESTDIR}/usr/bin/ex ${DESTDIR}/usr/bin/ex.bak + cp ${DESTDIR}/usr/bin/elvis ${DESTDIR}/usr/bin/ex (cd ${DESTDIR}/; \ (find ${CPIO_CPIO}; ls -d ${CPIO_CPIO_DIRS}) | \ cpio -H newc --block-size=16 -oav | \ gzip -9 >${MOUNT}/inst2.cpio.gz) - install -c -o root -g wheel -m 755 etc.i386/cpio.rc \ - ${MOUNT}/rc - install -c -o root -g wheel -m 755 etc.i386/cpio.install \ - ${MOUNT}/install - install -c -o root -g wheel -m 755 etc.i386/cpio.magic \ - ${MOUNT}/magic + # cpio is done, put everything back in shape for the bindist. + mv ${DESTDIR}/usr/share/misc/otermcap ${DESTDIR}/usr/share/misc/termcap + cp ${DESTDIR}/usr/bin/ex.bak ${DESTDIR}/usr/bin/ex + rm ${DESTDIR}/usr/bin/ex.bak + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/cpio.rc ${MOUNT}/rc + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/cpio.install ${MOUNT}/install + install -c -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${.CURDIR}/etc.i386/cpio.magic ${MOUNT}/magic df -ik ${MOUNT} umount /dev/${FLOPPY} fsck /dev/r${FLOPPY} dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/cpio.flp \ bs=15b count=160 gzip --no-name -9 -c ${RELEASEDIR}/floppies/cpio.flp \ - >${RELEASEDIR}/floppies/cpio.flp.gz + >${RELEASEDIR}/floppies/cpio.flp.gz & bin-tarball: (cd ${DESTDIR}; \ tar cf - . | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/bindist/bin_tgz.) + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/bindist/bin_tgz.) + +src-clean: + (cd ${DESTDIR}/usr/src; make cleandist) + find ${DESTDIR}/usr/src -name obj | xargs -n30 rm -rf + rm -rf ${DESTDIR}/usr/src/sys/compile/GENERIC* + chown -R bin:bin ${DESTDIR}/usr/src + chmod -R og-w ${DESTDIR}/usr/src srcbase-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/[A-Z]* | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/base.) + tar --exclude CVS -cf - usr/src/[A-Z]* | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/base.) srcbin-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/bin | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/bin.) + tar --exclude CVS -cf - usr/src/bin | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/srcbin.) srccontrib-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/contrib | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/contrib.) + tar --exclude CVS -cf - usr/src/contrib | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/contrib.) srcetc-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/etc | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/etc.) + tar --exclude CVS -cf - usr/src/etc | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/etc.) srcgames-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/games | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/games.) + tar --exclude CVS -cf - usr/src/games | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/games.) srcgnu-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/gnu | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/gnu.) + tar --exclude CVS -cf - usr/src/gnu | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/gnu.) srcinclude-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/include | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/include.) + tar --exclude CVS -cf - usr/src/include | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/include.) srclib-tarball: (cd ${DESTDIR}; \ - tar --exclude usr/src/${CRYPT_LIB} -cf - usr/src/lib | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/lib.) + tar --exclude usr/src/${CRYPT_LIB} --exclude CVS -cf - \ + usr/src/lib | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/lib.) srclibcrypt-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/${CRYPT_LIB} | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/secrdist/libcrypt.) + tar --exclude CVS -cf - usr/src/${CRYPT_LIB} | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/secrdist/libcrypt.) srclibexec-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/libexec | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/libexec.) + tar --exclude CVS -cf - usr/src/libexec | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/libexec.) srcsbin-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/sbin | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/sbin.) + tar --exclude CVS -cf - usr/src/sbin | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/sbin.) srcshare-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/share | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/share.) + tar --exclude CVS -cf - usr/src/share | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/share.) srcsys-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/sys | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/sys.) + tar --exclude CVS -cf - usr/src/sys | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/sys.) srcusrbin-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/usr.bin | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/usrbin.) + tar --exclude CVS -cf - usr/src/usr.bin | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/usrbin.) srcusrsbin-tarball: (cd ${DESTDIR}; \ - tar -cf - usr/src/usr.sbin | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/srcdist/usrsbin.) + tar --exclude CVS -cf - usr/src/usr.sbin | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/srcdist/usrsbin.) -src-tarball: srcbase-tarball srcbin-tarball srccontrib-tarball srcetc-tarball \ - srcgames-tarball srcgnu-tarball srcinclude-tarball srclib-tarball \ - srclibcrypt-tarball srclibexec-tarball srcsbin-tarball \ - srcshare-tarball srcsys-tarball srcusrbin-tarball \ - srcusrsbin-tarball +srckrb-tarball: + (cd ${DESTDIR}; \ + tar --exclude CVS -cf - usr/src/kerberosIV | \ + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/secrdist/kerberos.) + +src-tarball: src-clean srcbase-tarball srcbin-tarball srccontrib-tarball \ + srcetc-tarball srcgames-tarball srcgnu-tarball srcinclude-tarball \ + srclib-tarball srclibcrypt-tarball srclibexec-tarball srcsbin-tarball \ + srcshare-tarball srcsys-tarball srcusrbin-tarball srcusrsbin-tarball \ + srckrb-tarball des-tarball: rm -rf ${RELEASEDIR}/tmpdes @@ -530,30 +552,28 @@ des-tarball: done (cd ${RELEASEDIR}/tmpdes; \ tar cf - . | \ - gzip --no-name -9 -c | \ - split -b 240640 - \ - ${RELEASEDIR}/tarballs/secrdist/des_tgz.) + ${ZIPNSPLIT} ${RELEASEDIR}/tarballs/secrdist/des_tgz.) rm -rf ${RELEASEDIR}/tmpdes distrib-dirs: - mtree -u -f mtree/BSD.root.dist -p ${DESTDIR}/ - mtree -u -f mtree/BSD.var.dist -p ${DESTDIR}/var - mtree -u -f mtree/BSD.usr.dist -p ${DESTDIR}/usr + mtree -u -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/ + mtree -u -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var + mtree -u -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr .if defined(CDROMDIST) - mtree -u -f mtree/BSD.local.dist -p ${DESTDIR}/usr/local + mtree -u -f ${.CURDIR}/mtree/BSD.local.dist -p ${DESTDIR}/usr/local .endif cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys floppies: kcopy_ah.flp kcopy_bt.flp filesyst.flp cpio.flp \ cdins_ah.flp cdins_bt.flp -release: release-dirs distribution kcopy-kernels floppies \ - bin-tarball des-tarball - +release: release-dirs distribution crunch extract kcopy-kernels \ + floppies bin-tarball des-tarball clean + release-dirs: rm -rf ${RELEASEDIR}/filesys mkdir ${RELEASEDIR}/filesys - chown root.wheel ${RELEASEDIR}/filesys + chown ${BINOWN}.${BINGRP} ${RELEASEDIR}/filesys chmod 755 ${RELEASEDIR}/filesys rm -rf ${RELEASEDIR}/tarballs mkdir ${RELEASEDIR}/tarballs @@ -561,11 +581,11 @@ release-dirs: mkdir ${RELEASEDIR}/tarballs/objdist mkdir ${RELEASEDIR}/tarballs/secrdist mkdir ${RELEASEDIR}/tarballs/srcdist - chown -R root.wheel ${RELEASEDIR}/tarballs + chown -R ${BINOWN}.${BINGRP} ${RELEASEDIR}/tarballs chmod -R 755 ${RELEASEDIR}/tarballs rm -rf ${RELEASEDIR}/floppies mkdir ${RELEASEDIR}/floppies - chown root.wheel ${RELEASEDIR}/floppies + chown ${BINOWN}.${BINGRP} ${RELEASEDIR}/floppies chmod 755 ${RELEASEDIR}/floppies .include diff --git a/etc/crontab b/etc/crontab index a68a42083960..dcdd3cae9668 100644 --- a/etc/crontab +++ b/etc/crontab @@ -1,6 +1,6 @@ # /etc/crontab - root's crontab for FreeBSD # -# $Id: crontab,v 1.5.2.1 1994/04/15 17:46:56 sean Exp $ +# $Id: crontab,v 1.6 1994/04/15 16:57:38 sean Exp $ # From: Id: crontab,v 1.6 1993/05/31 02:03:57 cgd Exp # SHELL=/bin/sh diff --git a/etc/csh.login b/etc/csh.login index 040ba69f2d1e..4b827013c9d9 100644 --- a/etc/csh.login +++ b/etc/csh.login @@ -3,5 +3,5 @@ # information is shown in K-Blocks # setenv BLOCKSIZE K # Uncomment this, if you want to have 8-bit clean 'tcsh' -# (temporary solution until proper locale will be available) -# setenv LANG ru +# (any LANG value cause this, here example for russian language) +# setenv LANG Russian.koi8-r diff --git a/etc/daily b/etc/daily index c14b0eac9269..b30682500c91 100644 --- a/etc/daily +++ b/etc/daily @@ -25,8 +25,10 @@ fi if [ -d /scratch ]; then cd /scratch && { - find . ! -name . -atime +1 -exec rm -f -- {} \; - find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ + find . ! -name . ! -fstype local -a -prune -o \ + -atime +1 -exec rm -f -- {} \; + find . ! -name . ! -fstype local -a -prune -o \ + -type d -mtime +1 -exec rmdir -- {} \; \ >/dev/null 2>&1; } fi @@ -54,13 +56,18 @@ if [ -f /etc/news.expire ]; then /etc/news.expire fi -#echo "" -#echo "Purging accounting records:" -#mv /var/account/acct.2 /var/account/acct.3 -#mv /var/account/acct.1 /var/account/acct.2 -#mv /var/account/acct.0 /var/account/acct.1 -#cp /var/account/acct /var/account/acct.0 -#sa -s > /dev/null +if [ -d /var/account ] ; then + echo "" + echo "Purging accounting records:" + cd /var/account + if [ -f acct.2 ] ; then mv -f acct.2 acct.3 ; fi + if [ -f acct.1 ] ; then mv -f acct.1 acct.2 ; fi + if [ -f acct.0 ] ; then mv -f acct.0 acct.1 ; fi + if [ -f acct ] ; then + cp -pf acct acct.0 + sa -s > /dev/null + fi +fi echo "" echo "Backup passwd and group files:" diff --git a/etc/etc.i386/EXTRACT_bin.sh b/etc/etc.i386/EXTRACT_bin.sh new file mode 100755 index 000000000000..d6821747b195 --- /dev/null +++ b/etc/etc.i386/EXTRACT_bin.sh @@ -0,0 +1,18 @@ +#!/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 new file mode 100755 index 000000000000..37b7b72aefe4 --- /dev/null +++ b/etc/etc.i386/EXTRACT_secr.sh @@ -0,0 +1,15 @@ +#!/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 - +cat kerberos.aa | gunzip | tar --unlink --directory ${EXTRACT_TARGET} -xpf - diff --git a/etc/etc.i386/EXTRACT_src.sh b/etc/etc.i386/EXTRACT_src.sh new file mode 100755 index 000000000000..fc1680c5b241 --- /dev/null +++ b/etc/etc.i386/EXTRACT_src.sh @@ -0,0 +1,41 @@ +#!/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 srcbin.* | 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/MAKEDEV b/etc/etc.i386/MAKEDEV index 9433a69698e5..7d7815d239a5 100644 --- a/etc/etc.i386/MAKEDEV +++ b/etc/etc.i386/MAKEDEV @@ -74,8 +74,9 @@ # speaker pc speaker # tw* xten power controller # snd* various sound cards +# pcaudio PCM audio driver # -# $Id: MAKEDEV,v 1.28.2.1 1994/03/07 00:58:43 rgrimes Exp $ +# $Id: MAKEDEV,v 1.37 1994/06/17 21:50:07 jkh Exp $ # PATH=/sbin:/bin/:/usr/bin:/usr/sbin: @@ -89,9 +90,8 @@ all) sh MAKEDEV wd0 wd1 fd0 fd1 ft0 wt0 sd0 sd1 st0 cd0 mcd0 # bdev sh MAKEDEV pty0 tty0 tty1 pc0 lpt0 lpt1 lpt2 # cdev sh MAKEDEV ch0 tw0 bpf0 dcf0 lpa0 lpa1 lpa2 # cdev - sh MAKEDEV speaker mse0 ttyd2 ttyd3 # cdev - # NOTE: co0 and vty04 are not done by a "sh MAKEDEV all" - # these are for codrv and interfere with other devices! - rgrimes + sh MAKEDEV speaker pcaudio psm0 mse0 ttyd2 ttyd3 # cdev + sh MAKEDEV vty4 # cdev ;; std) rm -f console drum mem kmem null zero io tty klog stdin stdout stderr @@ -108,7 +108,7 @@ std) mknod stdout c 22 1; chmod 666 stdout; chown root.wheel stdout mknod stderr c 22 2; chmod 666 stderr; chown root.wheel stderr rm -f fd/* - mkdir fd > /dev/null 2>&1 + mkdir fd > null 2>&1 (cd fd && eval `echo "" | awk ' BEGIN { \ for (i = 0; i < 64; i++) \ printf("mknod %d c 22 %d;", i, i)}'`) @@ -120,7 +120,7 @@ std) # Create device files for new Archive/Wangtek QIC-02 tape driver (vak) wt*) - umask 2 ; u=`expr $i : '..\(.*\)'` + umask 7 ; u=`expr $i : '..\(.*\)'` if [ x$u = x ]; then u=0; fi rm -f r[Ww]t$u nr[Ww]t$u r[Ww]t$u[a-f] nr[Ww]t$u[a-f] mknod rwt${u} c 10 `expr 0 + $u` # default density, 512b blocks @@ -264,6 +264,14 @@ sd*|wd*) mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5` mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6` mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7` + case $i in + wd*) + mknod ${name}${unit}i b $blk `expr $unit '*' 8 + 64` + mknod ${name}${unit}j b $blk `expr $unit '*' 8 + 65` + mknod ${name}${unit}k b $blk `expr $unit '*' 8 + 66` + mknod ${name}${unit}l b $blk `expr $unit '*' 8 + 67` + mknod ${name}${unit}m b $blk `expr $unit '*' 8 + 68` + esac mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0` mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1` mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2` @@ -272,8 +280,16 @@ sd*|wd*) mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5` mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6` mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7` - chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h] - chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h] + case $i in + wd*) + mknod r${name}${unit}i c $chr `expr $unit '*' 8 + 64` + mknod r${name}${unit}j c $chr `expr $unit '*' 8 + 65` + mknod r${name}${unit}k c $chr `expr $unit '*' 8 + 66` + mknod r${name}${unit}l c $chr `expr $unit '*' 8 + 67` + mknod r${name}${unit}m c $chr `expr $unit '*' 8 + 68` + esac + chgrp operator ${name}${unit}[a-m] r${name}${unit}[a-m] + chmod 640 ${name}${unit}[a-m] r${name}${unit}[a-m] ;; *) echo bad unit for disk in: $i @@ -292,7 +308,6 @@ com*) unit=`expr $i : '...\(.*\)'` rm -f tty0$unit mknod tty0$unit c 8 $unit - chown uucp.wheel tty0$unit ;; pty*) @@ -342,7 +357,7 @@ st*) nrst${unit}.${mode} \ erst${unit}.${mode} \ st${unit}ctl.${mode} - chmod 644 rst${unit}.${mode}\ + chmod 640 rst${unit}.${mode}\ nrst${unit}.${mode} \ erst${unit}.${mode} chmod 660 st${unit}ctl.${mode} @@ -416,7 +431,7 @@ tw*) # hv 22-apr-93 use this to create the necessary video device for # pccons driver -pc*) +pc?) chr=12 minor=0 name=ttyv0 @@ -427,7 +442,7 @@ pc*) ;; # Use this to create virtual consoles for syscons, pcvt or codrv -# /dev/ttyv0-b +# ttyv0-b # use as MAKEDEV vtyNN to create NN entries vty*) chr=12 @@ -469,19 +484,42 @@ speaker) chown root.wheel speaker ;; -cua*|ttyd*) - unit=`expr $i : '...d*\(.\)'` - rm -f tty0$unit cua0$unit ttyd$unit - mknod ttyd$unit c 28 $unit - mknod cua0$unit c 28 `expr $unit + 128` - chown uucp.wheel ttyd$unit cua0$unit +cua0?|cua?|ttyd?) + unit=`expr $i : '...[d0]*\(.\)$'` + rm -f tty*0$unit cua*0$unit tty*d$unit + case $unit in + [0-9]) m=$unit;; + a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;; + h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;; + o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;; + v) m=31;; + *) echo too many devices; exit 1;; + esac + mknod ttyd$unit c 28 $m + mknod ttyid$unit c 28 `expr $m + 32` + mknod ttyld$unit c 28 `expr $m + 64` + mknod cua0$unit c 28 `expr $m + 128` + mknod cuai0$unit c 28 `expr $m + 32 + 128` + mknod cual0$unit c 28 `expr $m + 64 + 128` + chown uucp.dialer cua*0$unit + chmod 660 cua*0$unit ;; -tty*) - unit=`expr $i : 'tty\(.\)'` - rm -f tty0$unit cua0$unit ttyd$unit +tty0?|tty?) + unit=`expr $i : 'tty0*\(.\)$'` + rm -f tty*0$unit cua*0$unit tty*d$unit + case $unit in + [0-9]) m=$unit;; + a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;; + h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;; + o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;; + v) m=31;; + *) echo too many devices; exit 1;; + esac umask 0 - mknod tty0$unit c 28 $unit + mknod tty0$unit c 28 $m + mknod ttyi0$unit c 28 `expr $m + 32` + mknod ttyl0$unit c 28 `expr $m + 64` umask 77 ;; @@ -510,47 +548,55 @@ mouse*) ln -s $name mouse ;; +pcaudio) + rm -f pcaudio pcaudioctl + mknod pcaudio c 24 0 + mknod pcaudioctl c 24 128 + chown root.wheel pcaudio pcaudioctl + chmod 666 pcaudio pcaudioctl + ;; + snd*) chr=30 - rm -f /dev/mixer # Mixer [ Control ] - mknod /dev/mixer c $chr 0 - chmod 666 /dev/mixer + rm -f mixer # Mixer [ Control ] + mknod mixer c $chr 0 + chmod 666 mixer - rm -f /dev/sequencer # Sequencer [ FM Synth and MIDI output ] - mknod /dev/sequencer c $chr 1 - chmod 666 /dev/sequencer + rm -f sequencer # Sequencer [ FM Synth and MIDI output ] + mknod sequencer c $chr 1 + chmod 666 sequencer - rm -f /dev/midi # Midi input [ Not implemented ] - mknod /dev/midi c $chr 2 + rm -f midi # Midi input [ Not implemented ] + mknod midi c $chr 2 - rm -f /dev/dsp # DSP [ Digitized voice ] - mknod /dev/dsp c $chr 3 - chmod 666 /dev/dsp + rm -f dsp # DSP [ Digitized voice ] + mknod dsp c $chr 3 + chmod 666 dsp - rm -f /dev/audio # SPARC audio [ Not fully implemented ] - mknod /dev/audio c $chr 4 - chmod 666 /dev/audio + rm -f audio # SPARC audio [ Not fully implemented ] + mknod audio c $chr 4 + chmod 666 audio - rm -f /dev/dsp16 # DSP16 [ Same as /dev/dsp, except 16 bits ] - mknod /dev/dsp16 c $chr 5 - chmod 666 /dev/dsp16 + rm -f dsp16 # DSP16 [ Same as dsp, except 16 bits ] + mknod dsp16 c $chr 5 + chmod 666 dsp16 - rm -f /dev/sndstat # Status Device [ Debugging interface ] - mknod /dev/sndstat c $chr 6 - chmod 666 /dev/sndstat + rm -f sndstat # Status Device [ Debugging interface ] + mknod sndstat c $chr 6 + chmod 666 sndstat - rm -f /dev/pro_midi # PRO_MIDI [PAS midi input and output] - mknod /dev/pro_midi c $chr 15 - chmod 666 /dev/pro_midi + rm -f pro_midi # PRO_MIDI [PAS midi input and output] + mknod pro_midi c $chr 15 + chmod 666 pro_midi - rm -f /dev/dsp1 # DSP 1 [ SB emulation of PAS16 or 2nd audio ] - mknod /dev/dsp1 c $chr 19 - chmod 666 /dev/dsp1 + rm -f dsp1 # DSP 1 [ SB emulation of PAS16 or 2nd audio ] + mknod dsp1 c $chr 19 + chmod 666 dsp1 - rm -f /dev/audio1 # Sparc Audio 1 [ SB emulation of PAS16 or 2nd audio ] - mknod /dev/audio1 c $chr 20 - chmod 666 /dev/audio1 + rm -f audio1 # Sparc Audio 1 [ SB emulation of PAS16 or 2nd audio ] + mknod audio1 c $chr 20 + chmod 666 audio1 ;; local) @@ -558,5 +604,9 @@ local) sh MAKEDEV.local ;; +*) + echo $i - no such device name + ;; + esac done diff --git a/etc/etc.i386/floppy.install_notes b/etc/etc.i386/README.1ST similarity index 94% rename from etc/etc.i386/floppy.install_notes rename to etc/etc.i386/README.1ST index 5b457018ee82..eccb3aab208a 100644 --- a/etc/etc.i386/floppy.install_notes +++ b/etc/etc.i386/README.1ST @@ -1,9 +1,12 @@ FLOPPY INSTALLATION NOTES FreeBSD - Release 1.1 + 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 @@ -103,7 +106,7 @@ to make initial installation of the system from floppy as easy as possible. 12. Reboot so that the system comes up multiuser by typing ``reboot''. -13. You are now running FreeBSD! Congradulations! You may now continue +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 @@ -140,4 +143,4 @@ to make initial installation of the system from floppy as easy as possible. 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.13.2.1 1994/05/05 03:58:27 rgrimes Exp $ +End of $Id: README.1ST,v 1.1 1994/06/28 09:01:53 jkh Exp $ diff --git a/etc/etc.i386/install_notes b/etc/etc.i386/README.INSTALL similarity index 87% rename from etc/etc.i386/install_notes rename to etc/etc.i386/README.INSTALL index fbf74c83aecc..b8f69d23c5c5 100644 --- a/etc/etc.i386/install_notes +++ b/etc/etc.i386/README.INSTALL @@ -1,7 +1,13 @@ INSTALLATION NOTES FreeBSD - Release 1.1 + 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 @@ -14,7 +20,7 @@ FreeBSD Release Contents: The FreeBSD Release consists of the following elements: -Bootable Kernel copy floppies +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 @@ -22,22 +28,22 @@ Bootable Kernel copy floppies 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 + You must choose between one of two kernel-copy floppy images, depending on your disk controller type. The - "kcopy_ah.flp" image supports the Adaptec 154x and 1742 - SCSI adapters, while "kcopy_bt.flp" supports the Bustek + "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 + 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 "filesyst.flp" and the - "cpio.flp". + 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, @@ -48,14 +54,6 @@ Installation floppies 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 @@ -67,14 +65,14 @@ FreeBSD distribution sets 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.ce (i.e., 57 files + 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 the + The source distribution sets can be found in under "srcdist" subdirectory of archive sites. It is consists - of files named base.aa to usrsbin.ae (i.e., 86 files - all told), plus the file CKSUMS*. + 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 @@ -82,6 +80,16 @@ FreeBSD distribution sets 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 @@ -94,14 +102,10 @@ FreeBSD distribution sets 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 (/). + 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 @@ -121,68 +125,22 @@ FreeBSD distribution sets 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.) +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). -Supported devices include: +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: - Standard floppy controllers + freebsd.cdrom.com:~ftp/pub/FreeBSD/RELNOTES - Standard hard disk controllers: - MFM - ESDI - IDE - RLL - SCSI hard disk controllers: - Adaptec 154x series * [kcopy_ah.flp] - Adaptec 174x series - Buslogic 545S - Bustek 742 (EISA) [kcopy_bt.flp] - 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 +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) @@ -193,15 +151,15 @@ Floppy Cntlr. fd0 0x3f0 6 2 Std. Hard Disk Cntlr. wd0 0x1f0 14 -AHA-154x SCSI Cntlr. 0x330 11 5 [kcopy_ah.flp] +AHA-154x SCSI Cntlr. 0x330 11 5 [kcopy-ah-floppy] -AHA-174x SCSI Cntlr. automatically configured [kcopy_ah.flp] +AHA-174x SCSI Cntlr. automatically configured [kcopy-ah-floppy] -BT742 SCSI Cntlr. 0x330 12 [kcopy_bt.flp] +BT742 SCSI Cntlr. 0x330 12 [kcopy-bt-floppy] UHA-14f SCSI Cntlr. or -UHA-34f SCSI Cntlr. 0x330 14 5 [kcopy_bt.flp] -(In FreeBSD 1.0 GAMMA and before, UHA was on IRQ 11) +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 @@ -214,6 +172,8 @@ Serial Ports com0 0x3f8 4 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 @@ -242,6 +202,7 @@ Interruptless Parallel (Printer) Port N.B.: Disable the lpt interrupt on the board or you will have problems using the lpa drivers. + Hard-Disk Storage Requirements --------- ------- ------------ @@ -251,9 +212,9 @@ 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 86 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 50 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, @@ -278,31 +239,31 @@ Installation is supported from several media types, including: 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 +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. +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.flp image. If you're using a BT-742 SCSI host adapter -or an Ultrastor adaptor, then you'll need the kcopy_bt.flp image. +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. +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.flp or -kcopy_bt.flp, filesyst.flp and cpio.flp) to the floppies. -For example, to write kcopy_ah.flp to a 5.25" 1.2 Mb floppy +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.flp of=/dev/fd0a bs=30b count=80 + $ 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.flp of=/dev/fd0a bs=36b count=80 + $ 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 @@ -513,7 +474,7 @@ 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 + 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 @@ -630,7 +591,7 @@ may hit Control-C at any prompt and then type `halt'. 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.flp disk, but this time at the prompt asking + 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 . @@ -653,7 +614,7 @@ may hit Control-C at any prompt and then type `halt'. Once again, this stage can take up to two minutes, so DO NOT PANIC! - You will be asked to insert the cpio.flp into a floppy + 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. @@ -668,7 +629,7 @@ may hit Control-C at any prompt and then type `halt'. binary. Or if you are using SCSI tape, the dos-floppy should contain the st command. - To load the dos-floppy, remove the cpio.flp from the + 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. @@ -681,7 +642,8 @@ may hit Control-C at any prompt and then type `halt'. 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_tgz.xx file set (see below for instructions). + 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. @@ -772,7 +734,7 @@ may hit Control-C at any prompt and then type `halt'. To install via FTP or NFS: First you must decide on a temporary directory to hold - the .xx files. The directory /usr/distrib + the .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. @@ -854,7 +816,7 @@ may hit Control-C at any prompt and then type `halt'. To install via Kermit: First you must decide on a temporary directory to hold - the .xx files. The directory /usr/distrib + the .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. @@ -930,20 +892,26 @@ may hit Control-C at any prompt and then type `halt'. Further Tips on Installing FreeBSD ------- ---- -- ---------- ------- - You might wish to install the bindist first, get that + 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. + 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 this command: + 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. To - get the install commands active again issue this command: - - . /magic + 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 @@ -1040,4 +1008,4 @@ THANKS FOR USING THIS; that's what makes it all worthwhile. 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.2.2 1994/05/05 09:08:55 rgrimes Exp $ +This is $Id: README.INSTALL,v 1.1 1994/06/28 09:01:55 jkh Exp $ diff --git a/etc/etc.i386/cdinst1.install b/etc/etc.i386/cdinst1.install index f60f833f4e05..bb8380ed5063 100644 --- a/etc/etc.i386/cdinst1.install +++ b/etc/etc.i386/cdinst1.install @@ -1,7 +1,7 @@ #!/bin/sh # cd install floppy disk /install script # -# $Id: cdinst1.install,v 1.1.2.3 1994/05/05 04:11:20 rgrimes Exp $ +# $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 @@ -432,7 +432,7 @@ sync verified_install="" while [ ! "$verified_install" ]; do # Begin of Big Loop -rotdelay="" +rotdelay="-d 0 -n 1" drivename=wd0 drivetype=wd sect_fwd="" @@ -459,13 +459,11 @@ e*|E*|st*|ST*) ;; i*|I*) type=ST506 - rotdelay="-d 0" ;; sc*|SC*) drivename=sd0 drivetype=sd type=SCSI - rotdelay="-d 0" DEFSECT=32 DEFHEAD=64 ;; @@ -474,6 +472,11 @@ sc*|SC*) 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..." @@ -859,7 +862,7 @@ if [ "$sect_fwd" = "sf:" ]; then 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" + [ "$badlist" ] && bad144 -a -c $drivename $badlist echo " done." fi @@ -991,7 +994,7 @@ n*) echo -n "What is the netmask? [0xffffff00] " read resp if [ "$resp" = "" ]; then - ifnetmask="netmask 0xffffff00" + ifnetmask="netmask 0xffffff00 else ifnetmask="netmask $resp" fi diff --git a/etc/etc.i386/cpio.magic b/etc/etc.i386/cpio.magic index d3a8e028533b..a4353d943dbc 100644 --- a/etc/etc.i386/cpio.magic +++ b/etc/etc.i386/cpio.magic @@ -1,5 +1,5 @@ #!bin/sh -# $Id: cpio.magic,v 1.2.2.4 1994/05/01 20:53:40 rgrimes Exp $ +# $Id: cpio.magic,v 1.13 1994/06/29 20:29:12 jkh Exp $ # set_tmp_dir() { @@ -104,7 +104,7 @@ load_fd() echo; if [ "$drive" != "C" ]; then echo "Insert floppy in drive $drive:, then press RETURN to copy files," - echo -n "or enter option (? for help): " + echo -n "or enter option (? for help): " else echo -n "Press RETURN to copy files, or enter option (? for help): " fi @@ -219,14 +219,14 @@ load_qic_tape() tmp_dir echo -n "Insert tape into QIC tape drive and hit return to continue: " read foo - tar xvf /dev/rwt0 + 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 xvf /dev/nrst0 + tar --unlink -xvf /dev/nrst0 } extract() { @@ -242,12 +242,7 @@ extract() tarverbose= ;; esac - #XXX ugly hack to eliminate busy files, copy them to /tmp and use them - #from there... even uglier.. we CAN NOT LOAD libc.so.1.0 from the tar - #balls or it spams tar!! - cp -p /bin/cat /usr/bin/gunzip /usr/bin/tar /tmp - - #XXX more ugly hacks to get around busy text files/symlink problems. + #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.$$ @@ -259,11 +254,10 @@ extract() mv /sbin/init /sbin/init.$$ fi for i in $*; do - /tmp/cat "$i"* | - /tmp/gunzip | - (cd / ; /tmp/tar --extract --file - --preserve-permissions --exclude libc.so.1.0 ${tarverbose} ) + cat "$i"* | + gunzip | + (cd / ; tar --unlink --extract --file - --preserve-permissions ${tarverbose} ) done - rm -f /tmp/cat /tmp/gunzip /tmp/tar sync [ X"$1" = X"bin" ] && echo "Run \`configure' to complete installation." echo "(wd is now: `pwd`)" @@ -359,6 +353,32 @@ configure() ;; 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 diff --git a/etc/etc.i386/cpio.rc b/etc/etc.i386/cpio.rc index b7832ef7d339..5ef92dc31760 100644 --- a/etc/etc.i386/cpio.rc +++ b/etc/etc.i386/cpio.rc @@ -1,4 +1,4 @@ -# $Id: cpio.rc,v 1.1.2.1 1994/03/06 08:44:08 rgrimes Exp $ +# $Id: cpio.rc,v 1.4 1994/06/04 12:00:51 jkh Exp $ # stty status '^T' @@ -56,11 +56,20 @@ rm -f /fastboot (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) OPSYSTEM=FreeBSD -RELEASE="1.1" +RELEASE="1.1.5" +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, 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 diff --git a/etc/etc.i386/inst1.install b/etc/etc.i386/inst1.install index d6fce87bc433..e3941174fb9e 100755 --- a/etc/etc.i386/inst1.install +++ b/etc/etc.i386/inst1.install @@ -9,7 +9,7 @@ export PATH OPSYSTEM=FreeBSD OPSYSID=165 -ROOTMIN=7 +ROOTMIN=8 SWAPMIN=8 USRMIN=7 DISKMIN=`expr $ROOTMIN + $SWAPMIN + 1` @@ -438,7 +438,7 @@ sync verified_install="" while [ ! "$verified_install" ]; do # Begin of Big Loop -rotdelay="" +rotdelay="-d 0 -n 1" drivename=wd0 drivetype=wd sect_fwd="" @@ -465,13 +465,11 @@ e*|E*|st*|ST*) ;; i*|I*) type=ST506 - rotdelay="-d 0" ;; sc*|SC*) drivename=sd0 drivetype=sd type=SCSI - rotdelay="-d 0" DEFSECT=32 DEFHEAD=64 ;; @@ -481,7 +479,11 @@ sc*|SC*) ;; esac echo -echo "Disk is of device type $drivetype." +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..." @@ -878,7 +880,7 @@ if [ "$sect_fwd" = "sf:" ]; then 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" + [ "$badlist" ] && bad144 -a -c $drivename $badlist echo " done." fi diff --git a/etc/etc.i386/inst2.rc b/etc/etc.i386/inst2.rc index c64ebfd30d27..acb3f1c6eee9 100644 --- a/etc/etc.i386/inst2.rc +++ b/etc/etc.i386/inst2.rc @@ -1,4 +1,4 @@ -# $Id: inst2.rc,v 1.1.2.2 1994/03/18 03:11:06 rgrimes Exp $ +# $Id: inst2.rc,v 1.4 1994/06/15 19:23:33 jkh Exp $ # stty status '^T' @@ -59,7 +59,7 @@ rm -f /fastboot (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) OPSYSTEM=FreeBSD -RELEASE="1.1" +RELEASE="1.1.5" echo "${OPSYSTEM} Base System Release ${RELEASE}" echo "" echo "Congratulations, you've got ${OPSYSTEM} on the hard disk!" diff --git a/etc/group b/etc/group index 5c38d3667727..2bd4805a19fa 100644 --- a/etc/group +++ b/etc/group @@ -11,6 +11,7 @@ games:*:13: staff:*:20:root guest:*:31:root nobody:*:39: +uucp:*:66: ingres:*:74:ingres dialer:*:117: nogroup:*:32766: diff --git a/etc/hosts b/etc/hosts index 08645ce9b767..6528805a96f4 100644 --- a/etc/hosts +++ b/etc/hosts @@ -1,4 +1,4 @@ -# $Id: hosts,v 1.2 1993/11/11 22:32:36 wollman Exp $ +# $Id: hosts,v 1.4 1994/06/24 23:50:16 wollman Exp $ # # Host Database # This file should contain the addresses and aliases @@ -10,10 +10,18 @@ 127.0.0.1 localhost localhost.my.domain # # Imaginary network. -#0.2 myname.my.domain myname -#0.3 myfriend.my.domain myfriend +#10.0.0.2 myname.my.domain myname +#10.0.0.3 myfriend.my.domain myfriend # -# NB: 0 is not a valid network number. PLEASE PLEASE PLEASE do not try +# 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/etc/inetd.conf b/etc/inetd.conf index 12bad1601099..127fe26017c6 100644 --- a/etc/inetd.conf +++ b/etc/inetd.conf @@ -30,12 +30,12 @@ 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! -#mountd/1 dgram rpc/udp wait root /sbin/mountd mountd #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 diff --git a/etc/kerberosIV/README b/etc/kerberosIV/README new file mode 100644 index 000000000000..1482e99cd1df --- /dev/null +++ b/etc/kerberosIV/README @@ -0,0 +1,35 @@ +# @(#)README 5.1 (Berkeley) 6/30/90 + +Notes about the contents of the /etc/kerberosIV directory: + +The file master_key contains a copy of the master key under which the +entire Kerberos database is encrypted. Disclosing this key would be bad +news. The reason it is stored in the filesystem is because the following +programs need to inspect or modify the kereros database, and so the key +must be available for them, (or else it would have to be typed in by +hand): + - kerberos (the server itself) + - registerd (for new user registration) + - kpasswdd (for changing passwords) + +The srvtab file contains the encryption keys for each service on the local +host. Any host offering network services would have a key here, although +many such files can be used. + +The principal.* files comprise the Kerberos database itself, and contain +keys for all principles, and should not be world-readable. + +The kerberos.conf file contains the configuration for this machine: + - which realm I'm in + - which servers I should talk to for this realm + +The kerberos.realms file contains the name of Kerberos servers for +various (sub)domains. + +Kerberos log information it placed in /var/log/kerberos.log +(see rc.local to change it) + +The register_keys directory contains a set of files (all of which begin +with "."), each of which contains a des key used for registering new users +with the system. It is used only by the "registerd" program, and only on +a Kerberos server host. diff --git a/etc/kerberosIV/krb.conf b/etc/kerberosIV/krb.conf new file mode 100644 index 000000000000..11ac1ac78b01 --- /dev/null +++ b/etc/kerberosIV/krb.conf @@ -0,0 +1,9 @@ +CS.BERKELEY.EDU +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 diff --git a/etc/kerberosIV/krb.realms b/etc/kerberosIV/krb.realms new file mode 100644 index 000000000000..1f1bec58ae95 --- /dev/null +++ b/etc/kerberosIV/krb.realms @@ -0,0 +1,3 @@ +.berkeley.edu CS.BERKELEY.EDU +.MIT.EDU ATHENA.MIT.EDU +.mit.edu ATHENA.MIT.EDU diff --git a/etc/login.access b/etc/login.access new file mode 100644 index 000000000000..5cf54541463d --- /dev/null +++ b/etc/login.access @@ -0,0 +1,44 @@ +# 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/etc/make.conf b/etc/make.conf new file mode 100644 index 000000000000..da2c51abf17d --- /dev/null +++ b/etc/make.conf @@ -0,0 +1,71 @@ +# $Id: make.conf,v 1.8 1994/06/16 17:13:53 ache Exp $ +# +# This file, if present, will be read by make (see /usr/share/mk/sys.mk) +# It allows you to override macro definitions to make, without changing +# in your source tree, or anything the source tree installs. +# +# You have to find the things you can put here in the Makefiles and +# documentation of the source tree. +# +# This file must have a syntax as a Makefile. +# +# One, and probably the most common, use could be: +# +#CFLAGS= -O -m486 -pipe +# A lot of people report that -O2 works fine, but there are known +# bugs in gcc. -pipe will almost always speed up compilation. +# +# +# Another useful entry could be: +# +#NOPROFILE= no_way +# Avoid compiling profiled libraries +# +# +# To compile and install the Sun libm instead of the default use: +# +#WANT_MSUN= yes +# +# +# If you have a FPU (i387, i486DX, Pentium), you can make +# the Sun libm use the FPU: +# +#HAVE_FPU= yes +# +# +# If you do not want unformatted manual pages to be compressed +# when they are installed: +# +#NOMANCOMPRESS= no_way +# +# +# Default format for system documentation, depends on your printer. +# Set this to "ascii" for simple printers or screen +# +#PRINTER= ps +# +# +# How many times to check if a key has been pressed before giving up and +# booting the default kernel. 0 actually means check once, but saves the +# loop overhead. +# +#BOOTWAIT=0 +#BOOTWAIT=640000 +# +# +# Allow 'cc' to generate all FPU codes. Do not use this if you intend to +# generate code to run on machines with broken FPU emulator. Beware, this +# is a compile-time static option to 'cc'. +# +#CCFPU= yes +# +# +# If you use national 8-bit charset and your charset description is +# installed into /usr/share/locale (see setlocale(3)), you can +# automatically setup all ctype-oriented application to understand +# your charset properly by two things: +# 1) uncomment following option +# 2) set environment variable "LANG" to your charset name +# +#STARTUP_LOCALE= yes +# diff --git a/etc/master.passwd b/etc/master.passwd index f4c94367502c..6ebb2fe02b3e 100644 --- a/etc/master.passwd +++ b/etc/master.passwd @@ -5,7 +5,7 @@ operator:*:2:20::0:0:System &:/usr/guest/operator:/bin/csh bin:*:3:7::0:0:Binaries Commands and Source,,,:/:/nonexistent games:*:7:13::0:0:Games pseudo-user:/usr/games: man:*:9:9::0:0:Mister Man Pages:/usr/share/man: -uucp:*:66:1::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucico +uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucico ingres:*:267:74::0:0:& Group:/usr/ingres:/bin/csh falcon:*:32766:31::0:0:Prof. Steven &:/usr/games:/usr/games/wargames nobody:*:32767:9999::0:0:Unprivileged user:/nonexistent:/nonexistent diff --git a/etc/minfree b/etc/minfree new file mode 100644 index 000000000000..c873496a2275 --- /dev/null +++ b/etc/minfree @@ -0,0 +1 @@ +2048 diff --git a/etc/mtree/BSD.local.dist b/etc/mtree/BSD.local.dist index 9ff8a52c4b2d..cec50217217d 100644 --- a/etc/mtree/BSD.local.dist +++ b/etc/mtree/BSD.local.dist @@ -1,4 +1,4 @@ -# $Id: BSD.local.dist,v 1.4 1994/02/22 05:43:07 rgrimes Exp $ +# $Id: BSD.local.dist,v 1.5 1994/05/20 22:50:36 jkh Exp $ # /set type=file uname=bin gname=bin mode=0755 @@ -15,23 +15,23 @@ lib type=dir uname=bin gname=bin mode=0755 .. man type=dir uname=bin gname=bin mode=0755 - cat1 type=dir uname=bin gname=bin mode=0755 + cat1 type=dir uname=man gname=bin mode=0755 .. - cat2 type=dir uname=bin gname=bin mode=0755 + cat2 type=dir uname=man gname=bin mode=0755 .. - cat3 type=dir uname=bin gname=bin mode=0755 + cat3 type=dir uname=man gname=bin mode=0755 .. - cat4 type=dir uname=bin gname=bin mode=0755 + cat4 type=dir uname=man gname=bin mode=0755 .. - cat5 type=dir uname=bin gname=bin mode=0755 + cat5 type=dir uname=man gname=bin mode=0755 .. - cat6 type=dir uname=bin gname=bin mode=0755 + cat6 type=dir uname=man gname=bin mode=0755 .. - cat7 type=dir uname=bin gname=bin mode=0755 + cat7 type=dir uname=man gname=bin mode=0755 .. - cat8 type=dir uname=bin gname=bin mode=0755 + cat8 type=dir uname=man gname=bin mode=0755 .. - catl type=dir uname=bin gname=bin mode=0755 + catl type=dir uname=man gname=bin mode=0755 .. man1 type=dir uname=bin gname=bin mode=0755 .. diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index 5d767c825b5a..250d39f56478 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -1,10 +1,10 @@ -# $Id: BSD.root.dist,v 1.10 1994/02/17 03:52:28 rgrimes Exp $ +# $Id: BSD.root.dist,v 1.13 1994/06/12 16:20:36 csgr Exp $ # # top-level files are owned by root.wheel # (else too easy to get root by compromising these) -/set type=file uname=root gname=wheel mode=0775 +/set type=file uname=root gname=wheel mode=0755 sys type=link size=12 link=usr/src/sys @@ -20,7 +20,9 @@ etc type=dir .. namedb type=dir .. - uucp type=dir uname=root gname=wheel mode=0755 + uucp type=dir uname=uucp gname=uucp mode=0770 + .. + kerberosIV type=dir .. .. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 98ec625552d7..85e39bb09064 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1,4 +1,4 @@ -# $Id: BSD.usr.dist,v 1.9.2.1 1994/04/18 03:19:42 rgrimes Exp $ +# $Id: BSD.usr.dist,v 1.15 1994/06/01 02:39:37 ache Exp $ # /set type=file uname=bin gname=bin mode=0755 @@ -37,7 +37,7 @@ lib type=dir uname=bin gname=bin mode=0755 libexec type=dir uname=bin gname=bin mode=0755 lpr type=dir uname=bin gname=bin mode=0755 .. - uucp type=dir uname=bin gname=bin mode=0755 + uucp type=dir uname=bin gname=bin mode=0755 .. .. diff --git a/etc/mtree/BSD.var.dist b/etc/mtree/BSD.var.dist index 1646c9da0716..72b1a69a078c 100644 --- a/etc/mtree/BSD.var.dist +++ b/etc/mtree/BSD.var.dist @@ -1,4 +1,4 @@ -# $Id: BSD.var.dist,v 1.9 1994/02/15 10:38:50 rgrimes Exp $ +# $Id: BSD.var.dist,v 1.15 1994/05/31 07:49:53 ache Exp $ # /set type=dir uname=bin gname=bin mode=0755 @@ -36,7 +36,7 @@ rwho .. spool /set type=dir uname=bin gname=daemon mode=0755 - lock uname=uucp + lock uname=uucp gname=dialer mode=0775 .. lpd .. @@ -44,7 +44,7 @@ spool .. output .. - /set type=dir uname=uucp gname=daemon mode=0755 + /set type=dir uname=uucp gname=uucp mode=0775 uucp .Preserve .. @@ -57,6 +57,7 @@ spool .Xqtdir .. .. + /set type=dir uname=uucp gname=uucp mode=0777 uucppublic .. .. diff --git a/etc/netstart b/etc/netstart index a078218a76ba..a32e3f5e1443 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $Id: netstart,v 1.8.2.3 1994/05/04 08:57:11 rgrimes Exp $ +# $Id: netstart,v 1.12 1994/06/17 19:29:05 jkh Exp $ # From: @(#)netstart 5.9 (Berkeley) 3/30/91 routedflags=-q @@ -32,6 +32,9 @@ fi if [ -e /etc/hostname.is0 ]; then ifconfig is0 `cat /etc/hostname.is0` fi +if [ -e /etc/hostname.ze0 ]; then + ifconfig ze0 `cat /etc/hostname.ze0` +fi # set the address for the loopback interface ifconfig lo0 inet localhost diff --git a/etc/rc b/etc/rc index ee1b96427d73..84b3e41fc595 100644 --- a/etc/rc +++ b/etc/rc @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: rc,v 1.19.2.2 1994/04/18 04:14:19 rgrimes Exp $ +# $Id: rc,v 1.27 1994/06/06 17:45:37 phk Exp $ # From: @(#)rc 5.27 (Berkeley) 6/5/91 # System startup script run by init on autoboot @@ -59,6 +59,12 @@ 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 rm -f /fastboot # XXX (root now writeable) @@ -69,15 +75,21 @@ rm -f /fastboot # XXX (root now writeable) # 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/uucp/LCK.* -rm -f /var/spool/uucp/STST/* -# don't add .[a-z]* to rm, because of .adjkerntz file +rm -f /var/spool/lock/* +rm -f /var/spool/uucp/.Temp/* +# don't add .[a-z]* to rm, because of .adjkerntz file name (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) echo -n 'starting system logger' @@ -156,7 +168,7 @@ fi # 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 +elif [ X"${routedflags}" != X"NO" ]; then echo -n ' routed'; routed $routedflags fi @@ -207,6 +219,10 @@ 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 diff --git a/etc/rc.local b/etc/rc.local index dbbd909a5b91..34e9ca28536c 100644 --- a/etc/rc.local +++ b/etc/rc.local @@ -10,7 +10,7 @@ uname -a > $T echo "" >> $T sed '1,/^$/d' < /etc/motd >> $T cp $T /etc/motd -chmod 666 /etc/motd +chmod 644 /etc/motd rm -f $T echo -n 'starting local daemons:' diff --git a/etc/rc.serial b/etc/rc.serial new file mode 100644 index 000000000000..7f042e84e666 --- /dev/null +++ b/etc/rc.serial @@ -0,0 +1,91 @@ +# Change some defauls for serial devices. +# Standard defaults are: +# dtrwait 300 +# initial cflag from = cread cs8 hupcl +# initial iflag, lflag and oflag all 0 +# speed 9600 +# special chars from +# nothing locked +# except for serial consoles the initial iflag, lflag and oflag are from +# 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 :k5=\E?:\ + :k6=\E@:k7=\EA:k8=\EB:k9=\EC:k0=\ED: + +# The following is a version of the ibm-pc entry distributed with PC/IX, +# (Interactive Systems' System 3 for the Big Blue), modified by Richard +# McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, +# (the former is untrue, and the latter failed under UCB/man); standout and +# underline modes have been added. Note: this entry describes the "native" +# capabilities of the PC monochrome display, without ANY emulation; most +# communications packages (but NOT PC/IX connect) do some kind of emulation. +pc|ibmpc|ibm pc PC/IX:\ + :li#24: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: +pc3mono|IBM PC 386BSD Console with monochrome monitor:\ + :so=\E[0;1r\E[m:tc=pc3: +pc3|ibmpc3|IBM PC 386BSD Console:\ + :AL=\E[%dL:\ + :DL=\E[%dM:\ + :DO=\E[%dB:\ + :K1=\E[H:\ + :K2=\E[I:\ + :K3=\E[E:\ + :K4=\E[F:\ + :K5=\E[G:\ + :LE=\E[%dD:\ + :RI=\E[%dC:\ + :SF=\E[%dS:\ + :SR=\E[%dT:\ + :UP=\E[%dA:\ + :al=\E[L:\ + :am:\ + :bl=^G:\ + :bs:\ + :cb=\E[1K:\ + :cd=\E[J:\ + :ce=\E[K:\ + :cl=\E[H\E[J:\ + :cm=\E[%i%d;%dH:\ + :co#80:\ + :cr=^M:\ + :dl=\E[M:\ + :do=^J:\ + :ho=\E[H:\ + :is=\E[m:\ + :k0=\E[V:\ + :k1=\E[M:\ + :k2=\E[N:\ + :k3=\E[O:\ + :k4=\E[P:\ + :k5=\E[Q:\ + :k6=\E[R:\ + :k7=\E[S:\ + :k8=\E[T:\ + :k9=\E[U:\ + :kD=\177:\ + :kH=\E[F:\ + :kN=\E[G:\ + :kP=\E[I:\ + :kb=\177:\ + :kd=\E[B:\ + :kh=\E[H:\ + :kl=\E[D:\ + :kr=\E[C:\ + :ku=\E[A:\ + :le=^H:\ + :li#25:\ + :ms:\ + :nd=\E[C:\ + :pt:\ + :rs=\E[m:\ + :se=\E[m:\ + :sf=\E[S:\ + :so=\E[7;1r\E[7m:\ + :sr=\E[T:\ + :ta=^I:\ + :te=\E[m:\ + :ti=\E[m:\ + :up=\E[A: +# Syscons console with koi8-r russian code table. +# Some non-standard termcap extentions added at the end (after 'ac') +# for compatibility with current russian software. +# You might need to add correct filename to Ct entry +pc3r|ibmpc3r|FreeBSD console for syscons koi8-r code table:\ + :li#25:co#80:am:bs:bw:eo:cu=\222:\ + :UP=\E[%dA:DO=\E[%dB:RI=\E[%dC:LE=\E[%dD:AL=\E[%dL:DL=\E[%dM:\ + :IC=\E[%d@:DC=\E[%dP:le=^H:ic=\E[@:dc=\E[P:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%d;%dH:do=^J:ho=\E[H:al=\E[L:dl=\E[M:nd=\E[C:up=\E[A:\ + :so=\E[7m:se=\E[m:ms:rs=\E[x\E[m\Ec:pt:\ + :mb=\E[5m:mr=\E[7m:md=\E[1m:mh=\E[30m\E[1m:me=\E[m:\ + :kb=^H:kh=\E[H:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:\ + :kN=\E[G:kP=\E[I:kH=\E[F:kI=\E[L:kD=\E[K:kB=\E[Z:\ + :k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:k5=\E[Q:k6=\E[R:k7=\E[S:k8=\E[T:\ + :k9=\E[U:k0=\E[V:k.=\E[W:k-=\E[X:ko=k.,k-:kC=\E[E:\ + :sr=\E[T:sf=\E[S:SR=\E[%dT:SF=\E[%dS:\ + :ac=q\200x\201m\204v\211j\205t\206n\212u\207l\202w\210k\203y\230z\231f\234~\225a\221:\ + :Nf#16:Nb#8:Cf=\E[=%dF:Cb=\E[=%dG:\ + :gs=:ge=:g1=\200\201\204\211\205\206\212\207\202\210\203:\ + :g2=\240\241\253\273\256\261\276\265\245\270\250:\ + :f1=\E[M:f2=\E[N:f3=\E[O:f4=\E[P:f5=\E[Q:f6=\E[R:f7=\E[S:f8=\E[T:\ + :f9=\E[U:f0=\E[V:f.=\E[W:f-=\E[X:CY:Cs=:Ce=:Ct=: diff --git a/etc/ttys b/etc/ttys index 20fda7f79126..93406544ad30 100644 --- a/etc/ttys +++ b/etc/ttys @@ -3,17 +3,21 @@ # # name getty type status comments # -ttyv0 "/usr/libexec/getty Pc" pc3 on secure +# 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 off secure -ttyv2 "/usr/libexec/getty Pc" cons25 off secure +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 +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 diff --git a/games/Makefile b/games/Makefile index cc475918efb3..a57a1a15db07 100644 --- a/games/Makefile +++ b/games/Makefile @@ -11,7 +11,7 @@ #Missing: adventure boggle ching dungeon hunt phantasia quiz warp SUBDIR= arithmetic atc backgammon banner battlestar bcd caesar canfield \ - cribbage dm factor fish fortune hack hangman larn \ + cribbage dm factor fish fortune hangman larn \ mille monop morse number pom ppt primes rain robots rogue \ sail snake trek wargames worm worms wump diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c index 79e9e1cde71e..fee1ebe8a4c3 100644 --- a/games/fortune/fortune/fortune.c +++ b/games/fortune/fortune/fortune.c @@ -148,7 +148,7 @@ char *do_malloc(), *copy(), *off_name(); FILEDESC *pick_child(), *new_fp(); -extern char *malloc(), *index(), *rindex(), *strcpy(), *strcat(); +extern char *index(), *rindex(), *strcpy(), *strcat(); extern time_t time(); diff --git a/games/hack/COPYRIGHT b/games/hack/COPYRIGHT deleted file mode 100644 index 71a94494a8a0..000000000000 --- a/games/hack/COPYRIGHT +++ /dev/null @@ -1,6 +0,0 @@ -This entire subtree is copyright the Stichting Mathematisch Centrum. -The following copyright notice applies to all files found here. None of -these files contain AT&T proprietary source code. -_____________________________________________________________________________ - -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ diff --git a/games/hack/Makefile b/games/hack/Makefile deleted file mode 100644 index cc1af7a77784..000000000000 --- a/games/hack/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# @(#)Makefile 5.10 (Berkeley) 12/8/90 - -PROG= hack -SRCS= alloc.c hack.Decl.c hack.apply.c hack.bones.c hack.c hack.cmd.c \ - hack.do.c hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c \ - hack.end.c hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c \ - hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c hack.mklev.c \ - hack.mkmaze.c hack.mkobj.c hack.mkshop.c hack.mon.c hack.monst.c \ - hack.o_init.c hack.objnam.c hack.options.c hack.pager.c hack.potion.c \ - hack.pri.c hack.read.c hack.rip.c hack.rumors.c hack.save.c \ - hack.search.c hack.shk.c hack.shknam.c hack.steal.c hack.termcap.c \ - hack.timeout.c hack.topl.c hack.track.c hack.trap.c hack.tty.c \ - hack.u_init.c hack.unix.c hack.vault.c hack.version.c hack.wield.c \ - hack.wizard.c hack.worm.c hack.worn.c hack.zap.c rnd.c -CFLAGS+= -I. -fwritable-strings -MAN6= hack.6 -DPSRCS= hack.onames.h -DPADD= ${LIBTERM} -LDADD= -ltermcap -HIDEGAME=hidegame -CLEANFILES= hack.onames.h makedefs - -hack.onames.h: makedefs def.objects.h - ./makedefs ${.CURDIR}/def.objects.h > hack.onames.h - -makedefs: makedefs.c - ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${.PREFIX}.c - -beforeinstall: - install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \ - ${DESTDIR}/var/games/hackdir/perm - install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \ - ${DESTDIR}/var/games/hackdir/record - install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/help \ - ${.CURDIR}/hh ${.CURDIR}/data ${DESTDIR}/var/games/hackdir - rm -f ${DESTDIR}/var/games/hackdir/bones* - -.depend alloc.o: hack.onames.h - -.include diff --git a/games/hack/Makequest b/games/hack/Makequest deleted file mode 100644 index 9271c2841c92..000000000000 --- a/games/hack/Makequest +++ /dev/null @@ -1,196 +0,0 @@ -# Hack or Quest Makefile. - -# on some systems the termcap library is in -ltermcap -TERMLIB = -ltermlib - - -# make hack -GAME = quest -GAMEDIR = /usr/games/lib/questdir -CFLAGS = -g -DQUEST -HACKCSRC = hack.Decl.c\ - hack.apply.c hack.bones.c hack.c hack.cmd.c hack.do.c\ - hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c hack.end.c\ - hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c\ - hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c\ - hack.mklev.c hack.mkmaze.c hack.mkobj.c hack.mkshop.c\ - hack.mon.c hack.monst.c hack.o_init.c hack.objnam.c\ - hack.options.c hack.pager.c hack.potion.c hack.pri.c\ - hack.read.c hack.rip.c hack.rumors.c hack.save.c\ - hack.search.c hack.shk.c hack.shknam.c hack.steal.c\ - hack.termcap.c hack.timeout.c hack.topl.c\ - hack.track.c hack.trap.c hack.tty.c hack.unix.c\ - hack.u_init.c hack.vault.c\ - hack.wield.c hack.wizard.c hack.worm.c hack.worn.c hack.zap.c\ - hack.version.c rnd.c alloc.c - -CSOURCES = $(HACKCSRC) makedefs.c - -HSOURCES = hack.h hack.mfndpos.h config.h\ - def.edog.h def.eshk.h def.flag.h def.func_tab.h def.gold.h\ - def.mkroom.h\ - def.monst.h def.obj.h def.objclass.h def.objects.h\ - def.permonst.h def.rm.h def.trap.h def.wseg.h - -SOURCES = $(CSOURCES) $(HSOURCES) - -AUX = data help hh rumors hack.6 hack.sh - -DISTR = $(SOURCES) $(AUX) READ_ME Makefile date.h hack.onames.h - -HOBJ = hack.Decl.o hack.apply.o hack.bones.o hack.o hack.cmd.o hack.do.o\ - hack.do_name.o hack.do_wear.o hack.dog.o hack.eat.o hack.end.o\ - hack.engrave.o hack.fight.o hack.invent.o hack.ioctl.o\ - hack.lev.o hack.main.o hack.makemon.o hack.mhitu.o hack.mklev.o\ - hack.mkmaze.o hack.mkobj.o hack.mkshop.o hack.mon.o\ - hack.monst.o hack.o_init.o hack.objnam.o hack.options.o\ - hack.pager.o hack.potion.o hack.pri.o\ - hack.read.o hack.rip.o hack.rumors.o hack.save.o\ - hack.search.o hack.shk.o hack.shknam.o hack.steal.o\ - hack.termcap.o hack.timeout.o hack.topl.o\ - hack.track.o hack.trap.o\ - hack.tty.o hack.unix.o hack.u_init.o hack.vault.o hack.wield.o\ - hack.wizard.o hack.worm.o hack.worn.o hack.zap.o\ - hack.version.o rnd.o alloc.o - -$(GAME): $(HOBJ) Makefile - @echo "Loading ..." - @ld -X -o $(GAME) /lib/crt0.o $(HOBJ) $(TERMLIB) -lc - -all: $(GAME) lint - @echo "Done." - -makedefs: makedefs.c - cc -o makedefs makedefs.c - - -hack.onames.h: makedefs def.objects.h - makedefs > hack.onames.h - -lint: -# lint cannot have -p here because (i) capitals are meaningful: -# [Ww]izard, (ii) identifiers may coincide in the first six places: -# doweararm() versus dowearring(). -# _flsbuf comes from , a bug in the system libraries. - @echo lint -axbh -DLINT ... - @lint -axbh -DLINT $(HACKCSRC) | sed '/_flsbuf/d' - - -diff: - @- for i in $(SOURCES) $(AUX) ; do \ - cmp -s $$i $D/$$i || \ - ( echo diff $D/$$i $$i ; diff $D/$$i $$i ; echo ) ; done - -distribution: Makefile - @- for i in READ_ME $(SOURCES) $(AUX) Makefile date.h hack.onames.h\ - ; do \ - cmp -s $$i $D/$$i || \ - ( echo cp $$i $D ; cp $$i $D ) ; done -# the distribution directory also contains the empty files perm and record. - - -install: - rm -f $(GAMEDIR)/$(GAME) - cp $(GAME) $(GAMEDIR)/$(GAME) - chmod 04511 $(GAMEDIR)/$(GAME) - rm -f $(GAMEDIR)/bones* -# cp hack.6 /usr/man/man6 - -clean: - rm -f *.o - - -depend: -# For the moment we are lazy and disregard /usr/include files because -# the sources contain them conditionally. Perhaps we should use cpp. -# ( /bin/grep '^#[ ]*include' $$i | sed -n \ -# -e 's,<\(.*\)>,"/usr/include/\1",' \ -# - for i in ${CSOURCES}; do \ - ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \ - -e 's/[^"]*"\([^"]*\)".*/\1/' \ - -e H -e '$$g' -e '$$s/\n/ /g' \ - -e '$$s/.*/'$$i': &/' -e '$$s/\.c:/.o:/p' \ - >> makedep); done - for i in ${HSOURCES}; do \ - ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \ - -e 's/[^"]*"\([^"]*\)".*/\1/' \ - -e H -e '$$g' -e '$$s/\n/ /g' \ - -e '$$s/.*/'$$i': &\ - touch '$$i/p \ - >> makedep); done - @echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep - @echo '$$r makedep' >>eddep - @echo 'w' >>eddep - @cp Makefile Makefile.bak - ed - Makefile < eddep - @rm -f 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 - - diff Makefile Makefile.bak - @rm -f Makefile.bak - -# DO NOT DELETE THIS LINE - -hack.Decl.o: hack.h def.mkroom.h -hack.apply.o: hack.h def.edog.h def.mkroom.h -hack.bones.o: hack.h -hack.o: hack.h -hack.cmd.o: hack.h def.func_tab.h -hack.do.o: hack.h -hack.do_name.o: hack.h -hack.do_wear.o: hack.h -hack.dog.o: hack.h hack.mfndpos.h def.edog.h def.mkroom.h -hack.eat.o: hack.h -hack.end.o: hack.h -hack.engrave.o: hack.h -hack.fight.o: hack.h -hack.invent.o: hack.h def.wseg.h -hack.ioctl.o: config.h -hack.lev.o: hack.h def.mkroom.h def.wseg.h -hack.main.o: hack.h -hack.makemon.o: hack.h -hack.mhitu.o: hack.h -hack.mklev.o: hack.h def.mkroom.h -hack.mkmaze.o: hack.h def.mkroom.h -hack.mkobj.o: hack.h -hack.mkshop.o: hack.h def.mkroom.h def.eshk.h -hack.mon.o: hack.h hack.mfndpos.h -hack.monst.o: hack.h def.eshk.h -hack.o_init.o: config.h def.objects.h hack.onames.h -hack.objnam.o: hack.h -hack.options.o: config.h hack.h -hack.pager.o: hack.h -hack.potion.o: hack.h -hack.pri.o: hack.h def.wseg.h -hack.read.o: hack.h -hack.rip.o: hack.h -hack.rumors.o: hack.h -hack.save.o: hack.h -hack.search.o: hack.h -hack.shk.o: hack.h hack.mfndpos.h def.mkroom.h def.eshk.h -hack.shknam.o: hack.h -hack.steal.o: hack.h -hack.termcap.o: config.h def.flag.h -hack.timeout.o: hack.h -hack.topl.o: hack.h -hack.track.o: hack.h -hack.trap.o: hack.h def.mkroom.h -hack.tty.o: hack.h -hack.unix.o: hack.h def.mkroom.h -hack.u_init.o: hack.h -hack.vault.o: hack.h def.mkroom.h -hack.wield.o: hack.h -hack.wizard.o: hack.h -hack.worm.o: hack.h def.wseg.h -hack.worn.o: hack.h -hack.zap.o: hack.h -hack.version.o: date.h -hack.h: config.h def.objclass.h def.monst.h def.gold.h def.trap.h def.obj.h def.flag.h def.rm.h def.permonst.h hack.onames.h - touch hack.h -def.objects.h: config.h def.objclass.h - touch def.objects.h -# DEPENDENCIES MUST END AT END OF FILE -# IF YOU PUT STUFF HERE IT WILL GO AWAY -# see make depend above diff --git a/games/hack/OWNER b/games/hack/OWNER deleted file mode 100644 index be2d1e530444..000000000000 --- a/games/hack/OWNER +++ /dev/null @@ -1,2 +0,0 @@ -Andries Brouwer -mcvax!aeb diff --git a/games/hack/Original_READ_ME b/games/hack/Original_READ_ME deleted file mode 100644 index 9d2070be09e4..000000000000 --- a/games/hack/Original_READ_ME +++ /dev/null @@ -1,61 +0,0 @@ -This is export hack, my first semester programming project. - -To set it up for your system, you will have to do the following: - 1: create a hack uid, to own the top ten list, etc. - 2: create a hack directory "/usr/lib/game/hack" is the default. - 2.5: make the directory 700 mode. /* sav files go in there...*/ - 3: modify hack.main.c to use the new directory. - 4: modify hack.main.c so it uses the new hack gid. Gid accounts can -go into magic mode without the password, can get cores with ^G, etc. -(make sure gid isn't checked anywhere else...) - 5: recompile hack. - 6: put it in games after making it set-uid hack. - 8: fix the bugs I undobtedly left in it. - 9: tell me what you think of it. - - Hack uses the UCB file /etc/termcap to get your terminal escape codes. -If you don't use it, you will have to make extensive changes to hack.pri.c - -If you find any bugs (That you think I don't know about), or have any -awesome new changes (Like a better save (One that works!)), or have ANY -questions, write me - Jay Fenlason - 29 East St. - Sudbury Mass. - 01776 - -or call me at (617) 443-5036. Since I have both a modem and a teen-age -sister, Good Luck. - - -Hack is split (roughly) into several source files that do different things. -I have tried to fit all the procedures having to do with a certain segment -of the game into a single file, but the job is not the best in the world. -The rough splits are: - -hack.c General random stuff and things I never got around to moving. -hack.main.c main() and other random procedures, also the lock file stuff. -hack.mon.c Monsters, moving, attacking, etc. -hack.do.c drink, eat, read, wield, save, etc. -hack.do1.c zap, wear, remove, etc... -hack.pri.c stuff having to do with the screen, most of the terminal - independant stuff is in here. -hack.lev.c temp files and calling of mklev. - -Because of the peculiar restraints on our system, I make mklev (create -a level) a separate procedure execd by hack when needed. The source for -mklev is (Naturaly) mklev.c. You may want to put mklev back into hack. -Good luck. - -Most of hack was written by me, with help from - Kenny Woodland (KW) (general random things including - the original BUZZ()) - Mike Thome (MT) (The original chamelian) - and Jon Payne (JP) (The original lock file kludge and - the massive CURS()) - -This entire program would not have been possible without the SFSU Logo -Workshop. I am eternally grateful to all of our students (Especially K.L.), -without whom I would never have seen Rogue. I am especially grateful to -Mike Clancy, without whose generous help I would never have gotten to play -ROGUE. diff --git a/games/hack/READ_ME b/games/hack/READ_ME deleted file mode 100644 index cfe6ca2fe3eb..000000000000 --- a/games/hack/READ_ME +++ /dev/null @@ -1,92 +0,0 @@ -Hack is a display oriented dungeons & dragons - like game. -Both display and command structure resemble rogue. -(For a game with the same structure but entirely different display - -a real cave instead of dull rectangles - try Quest) - -Hack was originally written by Jay Fenlason (at lincolnsudbury: - 29 East St., Sudbury Mass., 01776) with help from - Kenny Woodland, Mike Thome and Jon Payne. -Basically it was an implementation of Rogue, however, with 52+ instead of 26 - monster types. -The current version is more than thrice as large (with such new features as - the dog, the long worms, the shops, etc.) and almost entirely rewritten - (only the display routines are the original ones - I must rewrite these - too one day; especially when you are blind strange things still happen). - -Files for hack: - hack The actual game - record Top 100 list (just start with an empty file) - news Tells about recent changes in hack, or bugs found ... - (Just start with no news file.) - data Auxiliary file used by hack to give you the names - and sometimes some more information on the - objects and monsters. - help Introductory information (no doubt outdated). - hh Compactified version of help. - perm An empty file used for locking purposes. - rumors Texts for fortune cookies. - (Some of these contain information on the game, - others are just plain stupid. Additional rumors - are appreciated.) - hack.sh A shell script. - (We have hack.sh in /usr/games/hack and - hack in /usr/games/lib/hackdir/hack and all the other - hack stuff in /usr/games/lib/hackdir - perhaps this - will make the script clear. - There is no need for you to use it.) - READ_ME This file. - Original_READ_ME Jay Fenlason's READ_ME - -System files used: - /etc/termcap Used in conjunction with the environment variable - $TERM. - /bin/cat - /usr/ucb/more - /bin/sh Used when $SHELL is undefined. - -How to install hack: -0. Compile the sources. Perhaps you should first look at the file config.h - and define BSD if you are on a BSDtype system, - define STUPID if your C-compiler chokes on complicated expressions. - Make sure schar and uchar represent signed and unsigned types. - If your C compiler doesnt allow initialization of bit fields - change Bitfield. When config.h looks reasonable, say 'make'. - (Perhaps you have to change TERMLIB in the makefile.) -1. If it didnt exist already, introduce a loginname `play' . -2. The program hack resides in a directory so that it is executable - for everybody and is suid play: - ---s--s--x 1 play 206848 Apr 3 00:17 hack - Perhaps you wish to restrict playing to certain hours, or have games - running under nice; in that case you might write a program play.c - such that the program play is suid play and executable for everybody - while all the games in /usr/games are readable or executable for - play only; all the program play does is asking for the name of a game, - checking that time-of-day and system load do not forbid playing, - and then executing the game. Thus: - -r-sr-sr-x 1 play 13312 May 24 12:52 play - ---x------ 1 play 206848 Apr 3 00:17 hack - If you are worried about security you might let play do - chroot("/usr/games") so that no player can get access to the rest - of the system via shell escapes and the likes. - If you #define SECURE in config.h then hack will not setuid(getuid()) - before executing a chdir(). Hack will always do setuid(getuid()) with - a fork. If you do not define UNIX then hack will not fork. -3. The rest of the stuff belonging to hack sits in a subdirectory hackdir - (on our system /usr/games/lib/hackdir) with modes - drwx------ 3 play 1024 Aug 9 09:03 hackdir - Here all the temporary files will be created (with names like xlock.17 - or user.5). -4. If you are not really short on file space, creating a subdirectory - hackdir/save (modes again drwx------) will enable users to save their - unfinished games. - -The program hack is called -$ hack [-d hackdir] [maxnrofplayers] -(for playing) or -$ hack [-d hackdir] -s [listofusers | limit | all] -(for seeing part of the scorelist). -The shell file hack (in this kit called hack.sh) takes care of -calling hack with the right arguments. - -Send complaints, bug reports, suggestions for improvements to -mcvax!aeb - in real life Andries Brouwer. diff --git a/games/hack/alloc.c b/games/hack/alloc.c deleted file mode 100644 index d94bf8b903b8..000000000000 --- a/games/hack/alloc.c +++ /dev/null @@ -1,47 +0,0 @@ -/* alloc.c - version 1.0.2 */ -#ifdef LINT - -/* - a ridiculous definition, suppressing - "possible pointer alignment problem" for (long *) malloc() - "enlarg defined but never used" - "ftell defined (in ) but never used" - from lint -*/ -#include -long * -alloc(n) unsigned n; { -long dummy = ftell(stderr); - if(n) dummy = 0; /* make sure arg is used */ - return(&dummy); -} - -#else - -extern char *malloc(); -extern char *realloc(); - -long * -alloc(lth) -register unsigned lth; -{ - register char *ptr; - - if(!(ptr = malloc(lth))) - panic("Cannot get %d bytes", lth); - return((long *) ptr); -} - -long * -enlarge(ptr,lth) -register char *ptr; -register unsigned lth; -{ - register char *nptr; - - if(!(nptr = realloc(ptr,lth))) - panic("Cannot reallocate %d bytes", lth); - return((long *) nptr); -} - -#endif LINT diff --git a/games/hack/config.h b/games/hack/config.h deleted file mode 100644 index f382937ba554..000000000000 --- a/games/hack/config.h +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* config.h - version 1.0.3 */ - -#include "pathnames.h" - -#ifndef CONFIG /* make sure the compiler doesnt see the typedefs twice */ - -#define CONFIG -#define UNIX /* delete if no fork(), exec() available */ -#define CHDIR /* delete if no chdir() available */ - -/* - * Some include files are in a different place under SYSV - * BSD SYSV - * - * - * - * Some routines are called differently - * index strchr - * rindex strrchr - * Also, the code for suspend and various ioctls is only given for BSD4.2 - * (I do not have access to a SYSV system.) - */ -#define BSD /* delete this line on System V */ - -/* #define STUPID */ /* avoid some complicated expressions if - your C compiler chokes on them */ -/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ -/* #define NOWAITINCLUDE */ /* neither nor exists */ - -#define WIZARD "bruno" /* the person allowed to use the -D option */ -#define RECORD "record"/* the file containing the list of topscorers */ -#define NEWS "news" /* the file containing the latest hack news */ -#define HELP "help" /* the file containing a description of the commands */ -#define SHELP "hh" /* abbreviated form of the same */ -#define RUMORFILE "rumors" /* a file with fortune cookies */ -#define DATAFILE "data" /* a file giving the meaning of symbols used */ -#define FMASK 0660 /* file creation mask */ -#define HLOCK "perm" /* an empty file used for locking purposes */ -#define LLOCK "safelock" /* link to previous */ - -#ifdef UNIX -/* - * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" - * If defined, it can be overridden by the environment variable PAGER. - * Hack will use its internal pager if DEF_PAGER is not defined. - * (This might be preferable for security reasons.) - * #define DEF_PAGER ".../mydir/mypager" - */ - -/* - * If you define MAIL, then the player will be notified of new mail - * when it arrives. If you also define DEF_MAILREADER then this will - * be the default mail reader, and can be overridden by the environment - * variable MAILREADER; otherwise an internal pager will be used. - * A stat system call is done on the mailbox every MAILCKFREQ moves. - */ -/* #define MAIL */ -#define DEF_MAILREADER _PATH_MAIL /* or e.g. /bin/mail */ -#define MAILCKFREQ 100 - - -#define SHELL /* do not delete the '!' command */ - -#ifdef BSD -#define SUSPEND /* let ^Z suspend the game */ -#endif BSD -#endif UNIX - -#ifdef CHDIR -/* - * If you define HACKDIR, then this will be the default playground; - * otherwise it will be the current directory. - */ -#ifdef QUEST -#define HACKDIR _PATH_QUEST -#else QUEST -#define HACKDIR _PATH_HACK -#endif QUEST - -/* - * Some system administrators are stupid enough to make Hack suid root - * or suid daemon, where daemon has other powers besides that of reading or - * writing Hack files. In such cases one should be careful with chdir's - * since the user might create files in a directory of his choice. - * Of course SECURE is meaningful only if HACKDIR is defined. - */ -#define SECURE /* do setuid(getuid()) after chdir() */ - -/* - * If it is desirable to limit the number of people that can play Hack - * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS. - * #define MAX_NR_OF_PLAYERS 100 - */ -#endif CHDIR - -/* size of terminal screen is (at least) (ROWNO+2) by COLNO */ -#define COLNO 80 -#define ROWNO 22 - -/* - * small signed integers (8 bits suffice) - * typedef char schar; - * will do when you have signed characters; otherwise use - * typedef short int schar; - */ -typedef char schar; - -/* - * small unsigned integers (8 bits suffice - but 7 bits do not) - * - these are usually object types; be careful with inequalities! - - * typedef unsigned char uchar; - * will be satisfactory if you have an "unsigned char" type; otherwise use - * typedef unsigned short int uchar; - */ -typedef unsigned char uchar; - -/* - * small integers in the range 0 - 127, usually coordinates - * although they are nonnegative they must not be declared unsigned - * since otherwise comparisons with signed quantities are done incorrectly - */ -typedef schar xchar; -typedef xchar boolean; /* 0 or 1 */ -#define TRUE 1 -#define FALSE 0 - -/* - * Declaration of bitfields in various structs; if your C compiler - * doesnt handle bitfields well, e.g., if it is unable to initialize - * structs containing bitfields, then you might use - * #define Bitfield(x,n) uchar x - * since the bitfields used never have more than 7 bits. (Most have 1 bit.) - */ -#define Bitfield(x,n) unsigned x:n - -#define SIZE(x) (int)(sizeof(x) / sizeof(x[0])) - -#endif CONFIG diff --git a/games/hack/data b/games/hack/data deleted file mode 100644 index 5d8d509b0fd9..000000000000 --- a/games/hack/data +++ /dev/null @@ -1,232 +0,0 @@ - Hack & Quest data file - version 1.0.3 -@ human (or you) -- a wall -| a wall -+ a door -. the floor of a room - a dark part of a room -# a corridor -} water filled area -< the staircase to the previous level -> the staircase to the next level -^ a trap -$ a pile, pot or chest of gold -%% a piece of food -! a potion -* a gem -? a scroll -= a ring -/ a wand -[ a suit of armor -) a weapon -( a useful item (camera, key, rope etc.) -0 an iron ball -_ an iron chain -` an enormous rock -" an amulet -, a trapper -: a chameleon -; a giant eel -' a lurker above -& a demon -A a giant ant -B a giant bat -C a centaur; - Of all the monsters put together by the Greek imagination - the Centaurs (Kentauroi) constituted a class in themselves. - Despite a strong streak of sensuality in their make-up, - their normal behaviour was moral, and they took a kindly - thought of man's welfare. The attempted outrage of Nessos on - Deianeira, and that of the whole tribe of Centaurs on the - Lapith women, are more than offset by the hospitality of - Pholos and by the wisdom of Cheiron, physician, prophet, - lyrist, and the instructor of Achilles. Further, the Cen- - taurs were peculiar in that their nature, which united the - body of a horse with the trunk and head of a man, involved - an unthinkable duplication of vital organs and important - members. So grotesque a combination seems almost un-Greek. - These strange creatures were said to live in the caves and - clefts of the mountains, myths associating them especially - with the hills of Thessaly and the range of Erymanthos. - [Mythology of all races, Vol. 1, pp. 270-271] -D a dragon; - In the West the dragon was the natural enemy of man. Although - preferring to live in bleak and desolate regions, whenever it was - seen among men it left in its wake a trail of destruction and - disease. Yet any attempt to slay this beast was a perilous under- - taking. For the dragon's assailant had to contend not only with - clouds of sulphurous fumes pouring from its fire-breathing nos- - trils, but also with the thrashings of its tail, the most deadly - part of its serpent-like body. - [From: Mythical Beasts by Deirdre Headon (The Leprechaun Library)] -E a floating eye -F a freezing sphere -G a gnome; - ... And then a gnome came by, carrying a bundle, an old fellow - three times as large as an imp and wearing clothes of a sort, - especially a hat. And he was clearly just as frightened as the - imps though he could not go so fast. Ramon Alonzo saw that there - must be some great trouble that was vexing magical things; and, - since gnomes speak the language of men, and will answer if spoken - to gently, he raised his hat, and asked of the gnome his name. - The gnome did not stop his hasty shuffle a moment as he answered - 'Alaraba' and grabbed the rim of his hat but forgot to doff it. - 'What is the trouble, Alaraba?' said Ramon Alonzo. - 'White magic. Run!' said the gnome ... - [From: The Charwoman's Shadow, by Lord Dunsany.] -H a hobgoblin; - Hobgoblin. Used by the Puritans and in later times for - wicked goblin spirits, as in Bunyan's 'Hobgoblin nor foul - friend', but its more correct use is for the friendly spir- - its of the brownie type. In 'A midsummer night's dream' a - fairy says to Shakespeare's Puck: - Those that Hobgoblin call you, and sweet Puck, - You do their work, and they shall have good luck: - Are you not he? - and obviously Puck would not wish to be called a hobgoblin - if that was an ill-omened word. - Hobgoblins are on the whole, good-humoured and ready to be - helpful, but fond of practical joking, and like most of the - fairies rather nasty people to annoy. Boggarts hover on the - verge of hobgoblindom. Bogles are just over the edge. - One Hob mentioned by Henderson, was Hob Headless who haunted - the road between Hurworth and Neasham, but could not cross - the little river Kent, which flowed into the Tess. He was - exorcised and laid under a large stone by the roadside for - ninety-nine years and a day. If anyone was so unwary as to - sit on that stone, he would be unable to quit it for ever. - The ninety-nine years is nearly up, so trouble may soon be - heard of on the road between Hurworth and Neasham. - [Katharine Briggs, A dictionary of Fairies] -I an invisible stalker -J a jackal -K a kobold -L a leprechaun; - The Irish Leprechaun is the Faeries' shoemaker and is known - under various names in different parts of Ireland: Cluri- - caune in Cork, Lurican in Kerry, Lurikeen in Kildare and Lu- - rigadaun in Tipperary. Although he works for the Faeries, - the Leprechaun is not of the same species. He is small, has - dark skin and wears strange clothes. His nature has some- - thing of the manic-depressive about it: first he is quite - happy, whistling merrily as he nails a sole on to a shoe; a - few minutes later, he is sullen and morose, drunk on his - home-made heather ale. The Leprechaun's two great loves are - tobacco and whiskey, and he is a first-rate con-man, impos- - sible to out-fox. No one, no matter how clever, has ever - managed to cheat him out of his hidden pot of gold or his - magic shilling. At the last minute he always thinks of some - way to divert his captor's attention and vanishes in the - twinkling of an eye. - [From: A Field Guide to the Little People - by Nancy Arrowsmith & George Moorse. ] -M a mimic -N a nymph -O an orc -P a purple worm -Q a quasit -R a rust monster -S a snake -T a troll -U an umber hulk -V a vampire -W a wraith -X a xorn -Y a yeti -Z a zombie -a an acid blob -b a giant beetle -c a cockatrice; - Once in a great while, when the positions of the stars are - just right, a seven-year-old rooster will lay an egg. Then, - along will come a snake, to coil around the egg, or a toad, - to squat upon the egg, keeping it warm and helping it to - hatch. When it hatches, out comes a creature called basil- - isk, or cockatrice, the most deadly of all creatures. A sin- - gle glance from its yellow, piercing toad's eyes will kill - both man and beast. Its power of destruction is said to be - so great that sometimes simply to hear its hiss can prove - fatal. Its breath is so venomenous that it causes all vege- - tation to wither. - There is, however, one creature which can withstand the - basilisk's deadly gaze, and this is the weasel. No one knows - why this is so, but although the fierce weasel can slay the - basilisk, it will itself be killed in the struggle. Perhaps - the weasel knows the basilisk's fatal weakness: if it ever - sees its own reflection in a mirror it will perish instant- - ly. But even a dead basilisk is dangerous, for it is said - that merely touching its lifeless body can cause a person to - sicken and die. - [From: Mythical Beasts by Deirdre Headon (The Leprechaun - Library) and other sources. ] -d a dog -e an ettin -f a fog cloud -g a gelatinous cube -h a homunculus -i an imp; - ... imps ... little creatures of two feet high that could - gambol and jump prodigiously; ... - [From: The Charwoman's Shadow, by Lord Dunsany.] - - An 'imp' is an off-shoot or cutting. Thus an 'ymp tree' was - a grafted tree, or one grown from a cutting, not from seed. - 'Imp' properly means a small devil, an off-shoot of Satan, - but the distinction between goblins or bogles and imps from - hell is hard to make, and many in the Celtic countries as - well as the English Puritans regarded all fairies as devils. - The fairies of tradition often hover uneasily between the - ghostly and the diabolic state. - [Katharine Briggs, A dictionary of Fairies] -j a jaguar -k a killer bee -l a leocrotta -m a minotaur -n a nurse -o an owlbear -p a piercer -q a quivering blob -r a giant rat -s a scorpion -t a tengu; - The tengu was the most troublesome creature of Japanese - legend. Part bird and part man, with red beak for a nose - and flashing eyes, the tengu was notorious for stirring up - feuds and prolonging enmity between families. Indeed, the - belligerent tengus were supposed to have been man's first - instructors in the use of arms. - [From: Mythical Beasts by Deirdre Headon - (The Leprechaun Library). ] -u a unicorn; - Men have always sought the elusive unicorn, for the single - twisted horn which projected from its forehead was thought - to be a powerful talisman. It was said that the unicorn had - simply to dip the tip of its horn in a muddy pool for the - water to become pure. Men also believed that to drink from - this horn was a protection against all sickness, and that if - the horn was ground to a powder it would act as an antidote - to all poisons. Less than 200 years ago in France, the horn - of a unicorn was used in a ceremony to test the royal food - for poison. - Although only the size of a small horse, the unicorn is a - very fierce beast, capable of killing an elephant with a - single thrust from its horn. Its fleetness of foot also - makes this solitary creature difficult to capture. However, - it can be tamed and captured by a maiden. Made gentle by the - sight of a virgin, the unicorn can be lured to lay its head - in her lap, and in this docile mood, the maiden may secure - it with a golden rope. - [From: Mythical Beasts by Deirdre Headon - (The Leprechaun Library). ] -v a violet fungi -w a long worm; - From its teeth the crysknife can be manufactured. -~ the tail of a long worm -x a xan; - The xan were animals sent to prick the legs of the Lords of Xibalba. -y a yellow light -z a zruty; - The zruty are wild and gigantic beings, living in the wildernesses - of the Tatra mountains. -1 The wizard of Yendor -2 The mail daemon diff --git a/games/hack/date.h b/games/hack/date.h deleted file mode 100644 index 9a7ef7688854..000000000000 --- a/games/hack/date.h +++ /dev/null @@ -1,2 +0,0 @@ - -char datestring[] = "Tue Jul 23 1985"; diff --git a/games/hack/def.edog.h b/games/hack/def.edog.h deleted file mode 100644 index a5c2b4616e01..000000000000 --- a/games/hack/def.edog.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.edog.h - version 1.0.2 */ - -struct edog { - long hungrytime; /* at this time dog gets hungry */ - long eattime; /* dog is eating */ - long droptime; /* moment dog dropped object */ - unsigned dropdist; /* dist of drpped obj from @ */ - unsigned apport; /* amount of training */ - long whistletime; /* last time he whistled */ -}; -#define EDOG(mp) ((struct edog *)(&(mp->mextra[0]))) diff --git a/games/hack/def.eshk.h b/games/hack/def.eshk.h deleted file mode 100644 index 2ebf2804d348..000000000000 --- a/games/hack/def.eshk.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.eshk.h - version 1.0.2 : added 'following' */ - -#define BILLSZ 200 -struct bill_x { - unsigned bo_id; - unsigned useup:1; - unsigned bquan:7; - unsigned price; /* price per unit */ -}; - -struct eshk { - long int robbed; /* amount stolen by most recent customer */ - boolean following; /* following customer since he owes us sth */ - schar shoproom; /* index in rooms; set by inshop() */ - coord shk; /* usual position shopkeeper */ - coord shd; /* position shop door */ - int shoplevel; /* level of his shop */ - int billct; - struct bill_x bill[BILLSZ]; - int visitct; /* nr of visits by most recent customer */ - char customer[PL_NSIZ]; /* most recent customer */ - char shknam[PL_NSIZ]; -}; diff --git a/games/hack/def.flag.h b/games/hack/def.flag.h deleted file mode 100644 index 221f33dd9166..000000000000 --- a/games/hack/def.flag.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.flag.h - version 1.0.3 */ - -struct flag { - unsigned ident; /* social security number for each monster */ - unsigned debug:1; /* in debugging mode */ -#define wizard flags.debug - unsigned toplin:2; /* a top line (message) has been printed */ - /* 0: top line empty; 2: no --More-- reqd. */ - unsigned cbreak:1; /* in cbreak mode, rogue format */ - unsigned standout:1; /* use standout for --More-- */ - unsigned nonull:1; /* avoid sending nulls to the terminal */ - unsigned time:1; /* display elapsed 'time' */ - unsigned nonews:1; /* suppress news printing */ - unsigned notombstone:1; - unsigned end_top, end_around; /* describe desired score list */ - unsigned end_own:1; /* idem (list all own scores) */ - unsigned no_rest_on_space:1; /* spaces are ignored */ - unsigned beginner:1; - unsigned female:1; - unsigned invlet_constant:1; /* let objects keep their - inventory symbol */ - unsigned move:1; - unsigned mv:1; - unsigned run:3; /* 0: h (etc), 1: H (etc), 2: fh (etc) */ - /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ - unsigned nopick:1; /* do not pickup objects */ - unsigned echo:1; /* 1 to echo characters */ - unsigned botl:1; /* partially redo status line */ - unsigned botlx:1; /* print an entirely new bottom line */ - unsigned nscrinh:1; /* inhibit nscr() in pline(); */ - unsigned made_amulet:1; - unsigned no_of_wizards:2;/* 0, 1 or 2 (wizard and his shadow) */ - /* reset from 2 to 1, but never to 0 */ - unsigned moonphase:3; -#define NEW_MOON 0 -#define FULL_MOON 4 - -}; - -extern struct flag flags; - diff --git a/games/hack/def.func_tab.h b/games/hack/def.func_tab.h deleted file mode 100644 index 63f74d2ef618..000000000000 --- a/games/hack/def.func_tab.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.func_tab.h - version 1.0.2 */ - -struct func_tab { - char f_char; - int (*f_funct)(); -}; - -extern struct func_tab cmdlist[]; - -struct ext_func_tab { - char *ef_txt; - int (*ef_funct)(); -}; - -extern struct ext_func_tab extcmdlist[]; diff --git a/games/hack/def.gen.h b/games/hack/def.gen.h deleted file mode 100644 index f1e44fc98977..000000000000 --- a/games/hack/def.gen.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.gen.h version 1.0.1: added ONCE flag */ - -struct gen { - struct gen *ngen; - xchar gx,gy; - unsigned gflag; /* 037: trap type; 040: SEEN flag */ - /* 0100: ONCE only */ -#define TRAPTYPE 037 -#define SEEN 040 -#define ONCE 0100 -}; -extern struct gen *fgold, *ftrap; -struct gen *g_at(); -#define newgen() (struct gen *) alloc(sizeof(struct gen)) diff --git a/games/hack/def.gold.h b/games/hack/def.gold.h deleted file mode 100644 index 808890883509..000000000000 --- a/games/hack/def.gold.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.gold.h - version 1.0.2 */ - -struct gold { - struct gold *ngold; - xchar gx,gy; - long amount; -}; - -extern struct gold *fgold; -struct gold *g_at(); -#define newgold() (struct gold *) alloc(sizeof(struct gold)) diff --git a/games/hack/def.mkroom.h b/games/hack/def.mkroom.h deleted file mode 100644 index ddbb62be1b02..000000000000 --- a/games/hack/def.mkroom.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.mkroom.h - version 1.0.3 */ - -struct mkroom { - schar lx,hx,ly,hy; /* usually xchar, but hx may be -1 */ - schar rtype,rlit,doorct,fdoor; -}; - -#define MAXNROFROOMS 15 -extern struct mkroom rooms[MAXNROFROOMS+1]; - -#define DOORMAX 100 -extern coord doors[DOORMAX]; - -/* various values of rtype */ -/* 0: ordinary room; 8-15: various shops */ -/* Note: some code assumes that >= 8 means shop, so be careful when adding - new roomtypes */ -#define SWAMP 3 -#define VAULT 4 -#define BEEHIVE 5 -#define MORGUE 6 -#define ZOO 7 -#define SHOPBASE 8 -#define WANDSHOP 9 -#define GENERAL 15 diff --git a/games/hack/def.monst.h b/games/hack/def.monst.h deleted file mode 100644 index 88836af7aee3..000000000000 --- a/games/hack/def.monst.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.monst.h - version 1.0.2 */ - -struct monst { - struct monst *nmon; - struct permonst *data; - unsigned m_id; - xchar mx,my; - xchar mdx,mdy; /* if mdispl then pos where last displayed */ -#define MTSZ 4 - coord mtrack[MTSZ]; /* monster track */ - schar mhp,mhpmax; - char mappearance; /* nonzero for undetected 'M's and for '1's */ - Bitfield(mimic,1); /* undetected mimic */ - Bitfield(mdispl,1); /* mdx,mdy valid */ - Bitfield(minvis,1); /* invisible */ - Bitfield(cham,1); /* shape-changer */ - Bitfield(mhide,1); /* hides beneath objects */ - Bitfield(mundetected,1); /* not seen in present hiding place */ - Bitfield(mspeed,2); - Bitfield(msleep,1); - Bitfield(mfroz,1); - Bitfield(mconf,1); - Bitfield(mflee,1); /* fleeing */ - Bitfield(mfleetim,7); /* timeout for mflee */ - Bitfield(mcan,1); /* has been cancelled */ - Bitfield(mtame,1); /* implies peaceful */ - Bitfield(mpeaceful,1); /* does not attack unprovoked */ - Bitfield(isshk,1); /* is shopkeeper */ - Bitfield(isgd,1); /* is guard */ - Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */ - Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */ - Bitfield(mtrapped,1); /* trapped in a pit or bear trap */ - Bitfield(mnamelth,6); /* length of name (following mxlth) */ -#ifndef NOWORM - Bitfield(wormno,5); /* at most 31 worms on any level */ -#endif NOWORM - unsigned mtrapseen; /* bitmap of traps we've been trapped in */ - long mlstmv; /* prevent two moves at once */ - struct obj *minvent; - long mgold; - unsigned mxlth; /* length of following data */ - /* in order to prevent alignment problems mextra should - be (or follow) a long int */ - long mextra[1]; /* monster dependent info */ -}; - -#define newmonst(xl) (struct monst *) alloc((unsigned)(xl) + sizeof(struct monst)) - -extern struct monst *fmon; -extern struct monst *fallen_down; -struct monst *m_at(); - -/* these are in mspeed */ -#define MSLOW 1 /* slow monster */ -#define MFAST 2 /* speeded monster */ - -#define NAME(mtmp) (((char *) mtmp->mextra) + mtmp->mxlth) -#define MREGEN "TVi1" -#define UNDEAD "ZVW " diff --git a/games/hack/def.obj.h b/games/hack/def.obj.h deleted file mode 100644 index 50b21df1b8f0..000000000000 --- a/games/hack/def.obj.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.obj.h - version 1.0.3 */ - -struct obj { - struct obj *nobj; - unsigned o_id; - unsigned o_cnt_id; /* id of container object is in */ - xchar ox,oy; - xchar odx,ody; - uchar otyp; - uchar owt; - uchar quan; /* use oextra for tmp gold objects */ - schar spe; /* quality of weapon, armor or ring (+ or -) - number of charges for wand ( >= -1 ) - special for uball and amulet %% BAH */ - char olet; - char invlet; - Bitfield(oinvis,1); /* not yet implemented */ - Bitfield(odispl,1); - Bitfield(known,1); /* exact nature known */ - Bitfield(dknown,1); /* color or text known */ - Bitfield(cursed,1); - Bitfield(unpaid,1); /* on some bill */ - Bitfield(rustfree,1); - Bitfield(onamelth,6); - long age; /* creation date */ - long owornmask; -#define W_ARM 01L -#define W_ARM2 02L -#define W_ARMH 04L -#define W_ARMS 010L -#define W_ARMG 020L -#define W_ARMOR (W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG) -#define W_RINGL 010000L /* make W_RINGL = RING_LEFT (see uprop) */ -#define W_RINGR 020000L -#define W_RING (W_RINGL | W_RINGR) -#define W_WEP 01000L -#define W_BALL 02000L -#define W_CHAIN 04000L - long oextra[1]; /* used for name of ordinary objects - length - is flexible; amount for tmp gold objects */ -}; - -extern struct obj *fobj; - -#define newobj(xl) (struct obj *) alloc((unsigned)(xl) + sizeof(struct obj)) -#define ONAME(otmp) ((char *) otmp->oextra) -#define OGOLD(otmp) (otmp->oextra[0]) diff --git a/games/hack/def.objclass.h b/games/hack/def.objclass.h deleted file mode 100644 index 9e17de237ee7..000000000000 --- a/games/hack/def.objclass.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.objclass.h - version 1.0.3 */ - -/* definition of a class of objects */ - -struct objclass { - char *oc_name; /* actual name */ - char *oc_descr; /* description when name unknown */ - char *oc_uname; /* called by user */ - Bitfield(oc_name_known,1); - Bitfield(oc_merge,1); /* merge otherwise equal objects */ - char oc_olet; - schar oc_prob; /* probability for mkobj() */ - schar oc_delay; /* delay when using such an object */ - uchar oc_weight; - schar oc_oc1, oc_oc2; - int oc_oi; -#define nutrition oc_oi /* for foods */ -#define a_ac oc_oc1 /* for armors - only used in ARM_BONUS */ -#define ARM_BONUS(obj) ((10 - objects[obj->otyp].a_ac) + obj->spe) -#define a_can oc_oc2 /* for armors */ -#define bits oc_oc1 /* for wands and rings */ - /* wands */ -#define NODIR 1 -#define IMMEDIATE 2 -#define RAY 4 - /* rings */ -#define SPEC 1 /* +n is meaningful */ -#define wldam oc_oc1 /* for weapons and PICK_AXE */ -#define wsdam oc_oc2 /* for weapons and PICK_AXE */ -#define g_val oc_oi /* for gems: value on exit */ -}; - -extern struct objclass objects[]; - -/* definitions of all object-symbols */ - -#define ILLOBJ_SYM '\\' -#define AMULET_SYM '"' -#define FOOD_SYM '%' -#define WEAPON_SYM ')' -#define TOOL_SYM '(' -#define BALL_SYM '0' -#define CHAIN_SYM '_' -#define ROCK_SYM '`' -#define ARMOR_SYM '[' -#define POTION_SYM '!' -#define SCROLL_SYM '?' -#define WAND_SYM '/' -#define RING_SYM '=' -#define GEM_SYM '*' -/* Other places with explicit knowledge of object symbols: - * ....shk.c: char shtypes[] = "=/)%?!["; - * mklev.c: "=/)%?![<>" - * hack.mkobj.c: char mkobjstr[] = "))[[!!!!????%%%%/=**"; - * hack.apply.c: otmp = getobj("0#%", "put in"); - * hack.eat.c: otmp = getobj("%", "eat"); - * hack.invent.c: if(index("!%?[)=*(0/\"", sym)){ - * hack.invent.c: || index("%?!*",otmp->olet))){ - */ diff --git a/games/hack/def.objects.h b/games/hack/def.objects.h deleted file mode 100644 index b4400fc4a70b..000000000000 --- a/games/hack/def.objects.h +++ /dev/null @@ -1,289 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.objects.h - version 1.0.3 */ - -/* objects have letter " % ) ( 0 _ ` [ ! ? / = * */ -#include "config.h" -#include "def.objclass.h" -#define NULL (char *)0 - -struct objclass objects[] = { - - { "strange object", NULL, NULL, 1, 0, - ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 }, - { "amulet of Yendor", NULL, NULL, 1, 0, - AMULET_SYM, 100, 0, 2, 0, 0, 0 }, - -#define FOOD(name,prob,delay,weight,nutrition) { name, NULL, NULL, 1, 1,\ - FOOD_SYM, prob, delay, weight, 0, 0, nutrition } - -/* dog eats foods 0-4 but prefers 1 above 0,2,3,4 */ -/* food 4 can be read */ -/* food 5 improves your vision */ -/* food 6 makes you stronger (like Popeye) */ -/* foods CORPSE up to CORPSE+52 are cadavers */ - - FOOD("food ration", 50, 5, 4, 800), - FOOD("tripe ration", 20, 1, 2, 200), - FOOD("pancake", 3, 1, 1, 200), - FOOD("dead lizard", 3, 0, 1, 40), - FOOD("fortune cookie", 7, 0, 1, 40), - FOOD("carrot", 2, 0, 1, 50), - FOOD("tin", 7, 0, 1, 0), - FOOD("orange", 1, 0, 1, 80), - FOOD("apple", 1, 0, 1, 50), - FOOD("pear", 1, 0, 1, 50), - FOOD("melon", 1, 0, 1, 100), - FOOD("banana", 1, 0, 1, 80), - FOOD("candy bar", 1, 0, 1, 100), - FOOD("egg", 1, 0, 1, 80), - FOOD("clove of garlic", 1, 0, 1, 40), - FOOD("lump of royal jelly", 0, 0, 1, 200), - - FOOD("dead human", 0, 4, 40, 400), - FOOD("dead giant ant", 0, 1, 3, 30), - FOOD("dead giant bat", 0, 1, 3, 30), - FOOD("dead centaur", 0, 5, 50, 500), - FOOD("dead dragon", 0, 15, 150, 1500), - FOOD("dead floating eye", 0, 1, 1, 10), - FOOD("dead freezing sphere", 0, 1, 1, 10), - FOOD("dead gnome", 0, 1, 10, 100), - FOOD("dead hobgoblin", 0, 2, 20, 200), - FOOD("dead stalker", 0, 4, 40, 400), - FOOD("dead jackal", 0, 1, 10, 100), - FOOD("dead kobold", 0, 1, 10, 100), - FOOD("dead leprechaun", 0, 4, 40, 400), - FOOD("dead mimic", 0, 4, 40, 400), - FOOD("dead nymph", 0, 4, 40, 400), - FOOD("dead orc", 0, 2, 20, 200), - FOOD("dead purple worm", 0, 7, 70, 700), - FOOD("dead quasit", 0, 2, 20, 200), - FOOD("dead rust monster", 0, 5, 50, 500), - FOOD("dead snake", 0, 1, 10, 100), - FOOD("dead troll", 0, 4, 40, 400), - FOOD("dead umber hulk", 0, 5, 50, 500), - FOOD("dead vampire", 0, 4, 40, 400), - FOOD("dead wraith", 0, 1, 1, 10), - FOOD("dead xorn", 0, 7, 70, 700), - FOOD("dead yeti", 0, 7, 70, 700), - FOOD("dead zombie", 0, 1, 3, 30), - FOOD("dead acid blob", 0, 1, 3, 30), - FOOD("dead giant beetle", 0, 1, 1, 10), - FOOD("dead cockatrice", 0, 1, 3, 30), - FOOD("dead dog", 0, 2, 20, 200), - FOOD("dead ettin", 0, 1, 3, 30), - FOOD("dead fog cloud", 0, 1, 1, 10), - FOOD("dead gelatinous cube", 0, 1, 10, 100), - FOOD("dead homunculus", 0, 2, 20, 200), - FOOD("dead imp", 0, 1, 1, 10), - FOOD("dead jaguar", 0, 3, 30, 300), - FOOD("dead killer bee", 0, 1, 1, 10), - FOOD("dead leocrotta", 0, 5, 50, 500), - FOOD("dead minotaur", 0, 7, 70, 700), - FOOD("dead nurse", 0, 4, 40, 400), - FOOD("dead owlbear", 0, 7, 70, 700), - FOOD("dead piercer", 0, 2, 20, 200), - FOOD("dead quivering blob", 0, 1, 10, 100), - FOOD("dead giant rat", 0, 1, 3, 30), - FOOD("dead giant scorpion", 0, 1, 10, 100), - FOOD("dead tengu", 0, 3, 30, 300), - FOOD("dead unicorn", 0, 3, 30, 300), - FOOD("dead violet fungi", 0, 1, 10, 100), - FOOD("dead long worm", 0, 5, 50, 500), -/* %% wt of long worm should be proportional to its length */ - FOOD("dead xan", 0, 3, 30, 300), - FOOD("dead yellow light", 0, 1, 1, 10), - FOOD("dead zruty", 0, 6, 60, 600), - -/* weapons ... - ROCK come several at a time */ -/* weapons ... - (ROCK-1) are shot using idem+(BOW-ARROW) */ -/* weapons AXE, SWORD, THSWORD are good for worm-cutting */ -/* weapons (PICK-)AXE, DAGGER, CRYSKNIFE are good for tin-opening */ -#define WEAPON(name,prob,wt,ldam,sdam) { name, NULL, NULL, 1, 0 /*%%*/,\ - WEAPON_SYM, prob, 0, wt, ldam, sdam, 0 } - - WEAPON("arrow", 7, 0, 6, 6), - WEAPON("sling bullet", 7, 0, 4, 6), - WEAPON("crossbow bolt", 7, 0, 4, 6), - WEAPON("dart", 7, 0, 3, 2), - WEAPON("rock", 6, 1, 3, 3), - WEAPON("boomerang", 2, 3, 9, 9), - WEAPON("mace", 9, 3, 6, 7), - WEAPON("axe", 6, 3, 6, 4), - WEAPON("flail", 6, 3, 6, 5), - WEAPON("long sword", 8, 3, 8, 12), - WEAPON("two handed sword", 6, 4, 12, 6), - WEAPON("dagger", 6, 3, 4, 3), - WEAPON("worm tooth", 0, 4, 2, 2), - WEAPON("crysknife", 0, 3, 10, 10), - WEAPON("spear", 6, 3, 6, 8), - WEAPON("bow", 6, 3, 4, 6), - WEAPON("sling", 5, 3, 6, 6), - WEAPON("crossbow", 6, 3, 4, 6), - - { "whistle", "whistle", NULL, 0, 0, - TOOL_SYM, 90, 0, 2, 0, 0, 0 }, - { "magic whistle", "whistle", NULL, 0, 0, - TOOL_SYM, 10, 0, 2, 0, 0, 0 }, - { "expensive camera", NULL, NULL, 1, 1, - TOOL_SYM, 0, 0, 3, 0, 0, 0 }, - { "ice box", "large box", NULL, 0, 0, - TOOL_SYM, 0, 0, 40, 0, 0, 0 }, - { "pick-axe", NULL, NULL, 1, 1, - TOOL_SYM, 0, 0, 5, 6, 3, 0 }, - { "can opener", NULL, NULL, 1, 1, - TOOL_SYM, 0, 0, 1, 0, 0, 0 }, - { "heavy iron ball", NULL, NULL, 1, 0, - BALL_SYM, 100, 0, 20, 0, 0, 0 }, - { "iron chain", NULL, NULL, 1, 0, - CHAIN_SYM, 100, 0, 20, 0, 0, 0 }, - { "enormous rock", NULL, NULL, 1, 0, - ROCK_SYM, 100, 0, 200 /* > MAX_CARR_CAP */, 0, 0, 0 }, - -#define ARMOR(name,prob,delay,ac,can) { name, NULL, NULL, 1, 0,\ - ARMOR_SYM, prob, delay, 8, ac, can, 0 } - ARMOR("helmet", 3, 1, 9, 0), - ARMOR("plate mail", 5, 5, 3, 2), - ARMOR("splint mail", 8, 5, 4, 1), - ARMOR("banded mail", 10, 5, 4, 0), - ARMOR("chain mail", 10, 5, 5, 1), - ARMOR("scale mail", 10, 5, 6, 0), - ARMOR("ring mail", 15, 5, 7, 0), - /* the armors below do not rust */ - ARMOR("studded leather armor", 13, 3, 7, 1), - ARMOR("leather armor", 17, 3, 8, 0), - ARMOR("elven cloak", 5, 0, 9, 3), - ARMOR("shield", 3, 0, 9, 0), - ARMOR("pair of gloves", 1, 1, 9, 0), - -#define POTION(name,color) { name, color, NULL, 0, 1,\ - POTION_SYM, 0, 0, 2, 0, 0, 0 } - - POTION("restore strength", "orange"), - POTION("booze", "bubbly"), - POTION("invisibility", "glowing"), - POTION("fruit juice", "smoky"), - POTION("healing", "pink"), - POTION("paralysis", "puce"), - POTION("monster detection", "purple"), - POTION("object detection", "yellow"), - POTION("sickness", "white"), - POTION("confusion", "swirly"), - POTION("gain strength", "purple-red"), - POTION("speed", "ruby"), - POTION("blindness", "dark green"), - POTION("gain level", "emerald"), - POTION("extra healing", "sky blue"), - POTION("levitation", "brown"), - POTION(NULL, "brilliant blue"), - POTION(NULL, "clear"), - POTION(NULL, "magenta"), - POTION(NULL, "ebony"), - -#define SCROLL(name,text,prob) { name, text, NULL, 0, 1,\ - SCROLL_SYM, prob, 0, 3, 0, 0, 0 } - SCROLL("mail", "KIRJE", 0), - SCROLL("enchant armor", "ZELGO MER", 6), - SCROLL("destroy armor", "JUYED AWK YACC", 5), - SCROLL("confuse monster", "NR 9", 5), - SCROLL("scare monster", "XIXAXA XOXAXA XUXAXA", 4), - SCROLL("blank paper", "READ ME", 3), - SCROLL("remove curse", "PRATYAVAYAH", 6), - SCROLL("enchant weapon", "DAIYEN FOOELS", 6), - SCROLL("damage weapon", "HACKEM MUCHE", 5), - SCROLL("create monster", "LEP GEX VEN ZEA", 5), - SCROLL("taming", "PRIRUTSENIE", 1), - SCROLL("genocide", "ELBIB YLOH",2), - SCROLL("light", "VERR YED HORRE", 10), - SCROLL("teleportation", "VENZAR BORGAVVE", 5), - SCROLL("gold detection", "THARR", 4), - SCROLL("food detection", "YUM YUM", 1), - SCROLL("identify", "KERNOD WEL", 18), - SCROLL("magic mapping", "ELAM EBOW", 5), - SCROLL("amnesia", "DUAM XNAHT", 3), - SCROLL("fire", "ANDOVA BEGARIN", 5), - SCROLL("punishment", "VE FORBRYDERNE", 1), - SCROLL(NULL, "VELOX NEB", 0), - SCROLL(NULL, "FOOBIE BLETCH", 0), - SCROLL(NULL, "TEMOV", 0), - SCROLL(NULL, "GARVEN DEH", 0), - -#define WAND(name,metal,prob,flags) { name, metal, NULL, 0, 0,\ - WAND_SYM, prob, 0, 3, flags, 0, 0 } - - WAND("light", "iridium", 10, NODIR), - WAND("secret door detection", "tin", 5, NODIR), - WAND("create monster", "platinum", 5, NODIR), - WAND("wishing", "glass", 1, NODIR), - WAND("striking", "zinc", 9, IMMEDIATE), - WAND("slow monster", "balsa", 5, IMMEDIATE), - WAND("speed monster", "copper", 5, IMMEDIATE), - WAND("undead turning", "silver", 5, IMMEDIATE), - WAND("polymorph", "brass", 5, IMMEDIATE), - WAND("cancellation", "maple", 5, IMMEDIATE), - WAND("teleportation", "pine", 5, IMMEDIATE), - WAND("make invisible", "marble", 9, IMMEDIATE), - WAND("digging", "iron", 5, RAY), - WAND("magic missile", "aluminium", 10, RAY), - WAND("fire", "steel", 5, RAY), - WAND("sleep", "curved", 5, RAY), - WAND("cold", "short", 5, RAY), - WAND("death", "long", 1, RAY), - WAND(NULL, "oak", 0, 0), - WAND(NULL, "ebony", 0, 0), - WAND(NULL, "runed", 0, 0), - -#define RING(name,stone,spec) { name, stone, NULL, 0, 0,\ - RING_SYM, 0, 0, 1, spec, 0, 0 } - - RING("adornment", "engagement", 0), - RING("teleportation", "wooden", 0), - RING("regeneration", "black onyx", 0), - RING("searching", "topaz", 0), - RING("see invisible", "pearl", 0), - RING("stealth", "sapphire", 0), - RING("levitation", "moonstone", 0), - RING("poison resistance", "agate", 0), - RING("aggravate monster", "tiger eye", 0), - RING("hunger", "shining", 0), - RING("fire resistance", "gold", 0), - RING("cold resistance", "copper", 0), - RING("protection from shape changers", "diamond", 0), - RING("conflict", "jade", 0), - RING("gain strength", "ruby", SPEC), - RING("increase damage", "silver", SPEC), - RING("protection", "granite", SPEC), - RING("warning", "wire", 0), - RING("teleport control", "iron", 0), - RING(NULL, "ivory", 0), - RING(NULL, "blackened", 0), - -/* gems ************************************************************/ -#define GEM(name,color,prob,gval) { name, color, NULL, 0, 1,\ - GEM_SYM, prob, 0, 1, 0, 0, gval } - GEM("diamond", "blue", 1, 4000), - GEM("ruby", "red", 1, 3500), - GEM("sapphire", "blue", 1, 3000), - GEM("emerald", "green", 1, 2500), - GEM("turquoise", "green", 1, 2000), - GEM("aquamarine", "blue", 1, 1500), - GEM("tourmaline", "green", 1, 1000), - GEM("topaz", "yellow", 1, 900), - GEM("opal", "yellow", 1, 800), - GEM("garnet", "dark", 1, 700), - GEM("amethyst", "violet", 2, 650), - GEM("agate", "green", 2, 600), - GEM("onyx", "white", 2, 550), - GEM("jasper", "yellowish brown", 2, 500), - GEM("jade", "green", 2, 450), - GEM("worthless piece of blue glass", "blue", 20, 0), - GEM("worthless piece of red glass", "red", 20, 0), - GEM("worthless piece of yellow glass", "yellow", 20, 0), - GEM("worthless piece of green glass", "green", 20, 0), - { NULL, NULL, NULL, 0, 0, ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 } -}; - -char obj_symbols[] = { - ILLOBJ_SYM, AMULET_SYM, FOOD_SYM, WEAPON_SYM, TOOL_SYM, - BALL_SYM, CHAIN_SYM, ROCK_SYM, ARMOR_SYM, POTION_SYM, SCROLL_SYM, - WAND_SYM, RING_SYM, GEM_SYM, 0 }; -int bases[sizeof(obj_symbols)]; diff --git a/games/hack/def.permonst.h b/games/hack/def.permonst.h deleted file mode 100644 index b19efc6ae4bc..000000000000 --- a/games/hack/def.permonst.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.permonst.h - version 1.0.2 */ - -struct permonst { - char *mname,mlet; - schar mlevel,mmove,ac,damn,damd; - unsigned pxlth; -}; - -extern struct permonst mons[]; -#define PM_ACID_BLOB &mons[7] -#define PM_ZOMBIE &mons[13] -#define PM_PIERCER &mons[17] -#define PM_KILLER_BEE &mons[26] -#define PM_WRAITH &mons[33] -#define PM_MIMIC &mons[37] -#define PM_VAMPIRE &mons[43] -#define PM_CHAMELEON &mons[47] -#define PM_DEMON &mons[54] -#define PM_MINOTAUR &mons[55] /* last in mons array */ -#define PM_SHK &mons[56] /* very last */ -#define PM_GHOST &pm_ghost -#define PM_EEL &pm_eel -#define PM_WIZARD &pm_wizard -#define CMNUM 55 /* number of common monsters */ diff --git a/games/hack/def.rm.h b/games/hack/def.rm.h deleted file mode 100644 index f84921ca3365..000000000000 --- a/games/hack/def.rm.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.rm.h - version 1.0.2 */ - -/* Level location types */ -#define HWALL 1 -#define VWALL 2 -#define SDOOR 3 -#define SCORR 4 -#define LDOOR 5 -#define POOL 6 /* not yet fully implemented */ - /* this should in fact be a bit like lit */ -#define DOOR 7 -#define CORR 8 -#define ROOM 9 -#define STAIRS 10 - -/* - * Avoid using the level types in inequalities: - * these types are subject to change. - * Instead, use one of the macros below. - */ -#define IS_WALL(typ) ((typ) <= VWALL) -#define IS_ROCK(typ) ((typ) < POOL) /* absolutely nonaccessible */ -#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */ -#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM or STAIRS */ -#define ZAP_POS(typ) ((typ) > DOOR) - -/* - * A few of the associated symbols are not hardwired. - */ -#ifdef QUEST -#define CORR_SYM ':' -#else -#define CORR_SYM '#' -#endif QUEST -#define POOL_SYM '}' - -#define ERRCHAR '{' - -/* - * The structure describing a coordinate position. - * Before adding fields, remember that this will significantly affect - * the size of temporary files and save files. - */ -struct rm { - char scrsym; - unsigned typ:5; - unsigned new:1; - unsigned seen:1; - unsigned lit:1; -}; -extern struct rm levl[COLNO][ROWNO]; diff --git a/games/hack/def.trap.h b/games/hack/def.trap.h deleted file mode 100644 index 26946add76bb..000000000000 --- a/games/hack/def.trap.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.trap.h - version 1.0.2 */ - -struct trap { - struct trap *ntrap; - xchar tx,ty; - unsigned ttyp:5; - unsigned tseen:1; - unsigned once:1; -}; - -extern struct trap *ftrap; -struct trap *t_at(); -#define newtrap() (struct trap *) alloc(sizeof(struct trap)) - -/* various kinds of traps */ -#define BEAR_TRAP 0 -#define ARROW_TRAP 1 -#define DART_TRAP 2 -#define TRAPDOOR 3 -#define TELEP_TRAP 4 -#define PIT 5 -#define SLP_GAS_TRAP 6 -#define PIERC 7 -#define MIMIC 8 /* used only in mklev.c */ -#define TRAPNUM 9 /* if not less than 32, change sizeof(ttyp) */ - /* see also mtrapseen (bit map) */ diff --git a/games/hack/def.wseg.h b/games/hack/def.wseg.h deleted file mode 100644 index 0a2af7791d03..000000000000 --- a/games/hack/def.wseg.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.wseg.h - version 1.0.2 */ - -#ifndef NOWORM -/* worm structure */ -struct wseg { - struct wseg *nseg; - xchar wx,wy; - unsigned wdispl:1; -}; - -#define newseg() (struct wseg *) alloc(sizeof(struct wseg)) -#endif NOWORM diff --git a/games/hack/hack.6 b/games/hack/hack.6 deleted file mode 100644 index 5210c2630bcd..000000000000 --- a/games/hack/hack.6 +++ /dev/null @@ -1,155 +0,0 @@ -.TH HACK 6 "31 March 1985" -.UC 4 -.SH NAME -hack \- Exploring The Dungeons of Doom -.SH SYNOPSIS -.B /usr/games/hack -[ -.B \-d -.I directory -] -[ -.B \-n -] -[ -.B \-u -.I playername -] -.br -.B /usr/games/hack -[ -.B \-d -.I directory -] -.B \-s -[ -.B \-X -] -[ -.I playernames -] -.SH DESCRIPTION -.PP -.I Hack -is a display oriented dungeons & dragons - like game. -Both display and command structure resemble rogue. -(For a game with the same structure but entirely different display - -a real cave instead of dull rectangles - try Quest.) -.PP -To get started you really only need to know two commands. The command -.B ? -will give you a list of the available commands and the command -.B / -will identify the things you see on the screen. -.PP -To win the game (as opposed to merely playing to beat other people high -scores) you must locate the Amulet of Yendor which is somewhere below -the 20th level of the dungeon and get it out. Nobody has achieved this -yet and if somebody does, he will probably go down in history as a hero -among heros. -.PP -When the game ends, either by your death, when you quit, or if you escape -from the caves, -.I hack -will give you (a fragment of) the list of top scorers. The scoring -is based on many aspects of your behavior but a rough estimate is -obtained by taking the amount of gold you've found in the cave plus four -times your (real) experience. Precious stones may be worth a lot of gold -when brought to the exit. -There is a 10% penalty for getting yourself killed. -.PP -The administration of the game is kept in the directory specified with the -.B \-d -option, or, if no such option is given, in the directory specified by -the environment variable HACKDIR, or, if no such variable exists, in -the current directory. This same directory contains several auxiliary -files such as lockfiles and the list of topscorers and a subdirectory -.I save -where games are saved. -The game administrator may however choose to install hack with a fixed -playing ground, usually /usr/games/lib/hackdir. -.PP -The -.B \-n -option suppresses printing of the news. -.PP -The -.B \-u -.I playername -option supplies the answer to the question "Who are you?". -When -.I playername -has as suffix one of -.B \-T \-S \-K \-F \-C \-W -then this supplies the answer to the question "What kind of character ... ?". -.PP -The -.B \-s -option will print out the list of your scores. It may be followed by arguments -.B \-X -where X is one of the letters C, F, K, S, T, W to print the scores of -Cavemen, Fighters, Knights, Speleologists, Tourists or Wizards. -It may also be followed by one or more player names to print the scores of the -players mentioned. -.SH AUTHORS -Jay Fenlason (+ Kenny Woodland, Mike Thome and Jon Payne) wrote the -original hack, very much like rogue (but full of bugs). -.br -Andries Brouwer continuously deformed their sources into the current -version - in fact an entirely different game. -.SH FILES -.DT -.ta \w'data, rumors\ \ \ 'u -hack The hack program. -.br -data, rumors Data files used by hack. -.br -help, hh Help data files. -.br -record The list of topscorers. -.br -save A subdirectory containing the saved -.br - games. -.br -bones_dd Descriptions of the ghost and -.br - belongings of a deceased adventurer. -.br -xlock.dd Description of a dungeon level. -.br -safelock Lock file for xlock. -.br -record_lock Lock file for record. -.SH ENVIRONMENT -.DT -.ta \w'HACKPAGER, PAGER\ \ \ 'u -USER or LOGNAME Your login name. -.br -HOME Your home directory. -.br -SHELL Your shell. -.br -TERM The type of your terminal. -.br -HACKPAGER, PAGER Pager used instead of default pager. -.br -MAIL Mailbox file. -.br -MAILREADER Reader used instead of default -.br - (probably /bin/mail or /usr/ucb/mail). -.br -HACKDIR Playground. -.br -HACKOPTIONS String predefining several hack options -.br - (see help file). -.br - -Several other environment variables are used in debugging (wizard) mode, -like GENOCIDED, INVENT, MAGIC and SHOPTYPE. -.SH BUGS -.PP -Probably infinite. -Mail complaints to mcvax!aeb . diff --git a/games/hack/hack.Decl.c b/games/hack/hack.Decl.c deleted file mode 100644 index b2855ac93631..000000000000 --- a/games/hack/hack.Decl.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.Decl.c - version 1.0.3 */ - -#include "hack.h" -char nul[40]; /* contains zeros */ -char plname[PL_NSIZ]; /* player name */ -char lock[PL_NSIZ+4] = "1lock"; /* long enough for login name .99 */ - -boolean in_mklev, restoring; - -struct rm levl[COLNO][ROWNO]; /* level map */ -#ifndef QUEST -#include "def.mkroom.h" -struct mkroom rooms[MAXNROFROOMS+1]; -coord doors[DOORMAX]; -#endif QUEST -struct monst *fmon = 0; -struct trap *ftrap = 0; -struct gold *fgold = 0; -struct obj *fobj = 0, *fcobj = 0, *invent = 0, *uwep = 0, *uarm = 0, - *uarm2 = 0, *uarmh = 0, *uarms = 0, *uarmg = 0, *uright = 0, - *uleft = 0, *uchain = 0, *uball = 0; -struct flag flags; -struct you u; -struct monst youmonst; /* dummy; used as return value for boomhit */ - -xchar dlevel = 1; -xchar xupstair, yupstair, xdnstair, ydnstair; -char *save_cm = 0, *killer, *nomovemsg; - -long moves = 1; -long wailmsg = 0; - -int multi = 0; -char genocided[60]; -char fut_geno[60]; - -xchar curx,cury; -xchar seelx, seehx, seely, seehy; /* corners of lit room */ - -coord bhitpos; - -char quitchars[] = " \r\n\033"; diff --git a/games/hack/hack.apply.c b/games/hack/hack.apply.c deleted file mode 100644 index 18da738dfe9c..000000000000 --- a/games/hack/hack.apply.c +++ /dev/null @@ -1,437 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.apply.c - version 1.0.3 */ - -#include "hack.h" -#include "def.edog.h" -#include "def.mkroom.h" -static struct monst *bchit(); -extern struct obj *addinv(); -extern struct trap *maketrap(); -extern int (*occupation)(); -extern char *occtxt; -extern char quitchars[]; -extern char pl_character[]; - -static void use_camera(), use_ice_box(), use_whistle(), use_magic_whistle(); -static int use_pick_axe(); - -doapply() { - register struct obj *obj; - register int res = 1; - - obj = getobj("(", "use or apply"); - if(!obj) return(0); - - switch(obj->otyp){ - case EXPENSIVE_CAMERA: - use_camera(obj); break; - case ICE_BOX: - use_ice_box(obj); break; - case PICK_AXE: - res = use_pick_axe(obj); - break; - - case MAGIC_WHISTLE: - if(pl_character[0] == 'W' || u.ulevel > 9) { - use_magic_whistle(obj); - break; - } - /* fall into next case */ - case WHISTLE: - use_whistle(obj); - break; - - case CAN_OPENER: - if(!carrying(TIN)) { - pline("You have no can to open."); - goto xit; - } - pline("You cannot open a tin without eating its contents."); - pline("In order to eat, use the 'e' command."); - if(obj != uwep) - pline("Opening the tin will be much easier if you wield the can-opener."); - goto xit; - - default: - pline("Sorry, I don't know how to use that."); - xit: - nomul(0); - return(0); - } - nomul(0); - return(res); -} - -/* ARGSUSED */ -static void -use_camera(obj) /* register */ struct obj *obj; { -register struct monst *mtmp; - if(!getdir(1)){ /* ask: in what direction? */ - flags.move = multi = 0; - return; - } - if(u.uswallow) { - pline("You take a picture of %s's stomach.", monnam(u.ustuck)); - return; - } - if(u.dz) { - pline("You take a picture of the %s.", - (u.dz > 0) ? "floor" : "ceiling"); - return; - } - if(mtmp = bchit(u.dx, u.dy, COLNO, '!')) { - if(mtmp->msleep){ - mtmp->msleep = 0; - pline("The flash awakens %s.", monnam(mtmp)); /* a3 */ - } else - if(mtmp->data->mlet != 'y') - if(mtmp->mcansee || mtmp->mblinded){ - register int tmp = dist(mtmp->mx,mtmp->my); - register int tmp2; - if(cansee(mtmp->mx,mtmp->my)) - pline("%s is blinded by the flash!", Monnam(mtmp)); - setmangry(mtmp); - if(tmp < 9 && !mtmp->isshk && rn2(4)) { - mtmp->mflee = 1; - if(rn2(4)) mtmp->mfleetim = rnd(100); - } - if(tmp < 3) mtmp->mcansee = mtmp->mblinded = 0; - else { - tmp2 = mtmp->mblinded; - tmp2 += rnd(1 + 50/tmp); - if(tmp2 > 127) tmp2 = 127; - mtmp->mblinded = tmp2; - mtmp->mcansee = 0; - } - } - } -} - -static -struct obj *current_ice_box; /* a local variable of use_ice_box, to be - used by its local procedures in/ck_ice_box */ -static -in_ice_box(obj) register struct obj *obj; { - if(obj == current_ice_box || - (Punished && (obj == uball || obj == uchain))){ - pline("You must be kidding."); - return(0); - } - if(obj->owornmask & (W_ARMOR | W_RING)) { - pline("You cannot refrigerate something you are wearing."); - return(0); - } - if(obj->owt + current_ice_box->owt > 70) { - pline("It won't fit."); - return(1); /* be careful! */ - } - if(obj == uwep) { - if(uwep->cursed) { - pline("Your weapon is welded to your hand!"); - return(0); - } - setuwep((struct obj *) 0); - } - current_ice_box->owt += obj->owt; - freeinv(obj); - obj->o_cnt_id = current_ice_box->o_id; - obj->nobj = fcobj; - fcobj = obj; - obj->age = moves - obj->age; /* actual age */ - return(1); -} - -static -ck_ice_box(obj) register struct obj *obj; { - return(obj->o_cnt_id == current_ice_box->o_id); -} - -static -out_ice_box(obj) register struct obj *obj; { -register struct obj *otmp; - if(obj == fcobj) fcobj = fcobj->nobj; - else { - for(otmp = fcobj; otmp->nobj != obj; otmp = otmp->nobj) - if(!otmp->nobj) panic("out_ice_box"); - otmp->nobj = obj->nobj; - } - current_ice_box->owt -= obj->owt; - obj->age = moves - obj->age; /* simulated point of time */ - (void) addinv(obj); -} - -static void -use_ice_box(obj) register struct obj *obj; { -register int cnt = 0; -register struct obj *otmp; - current_ice_box = obj; /* for use by in/out_ice_box */ - for(otmp = fcobj; otmp; otmp = otmp->nobj) - if(otmp->o_cnt_id == obj->o_id) - cnt++; - if(!cnt) pline("Your ice-box is empty."); - else { - pline("Do you want to take something out of the ice-box? [yn] "); - if(readchar() == 'y') - if(askchain(fcobj, (char *) 0, 0, out_ice_box, ck_ice_box, 0)) - return; - pline("That was all. Do you wish to put something in? [yn] "); - if(readchar() != 'y') return; - } - /* call getobj: 0: allow cnt; #: allow all types; %: expect food */ - otmp = getobj("0#%", "put in"); - if(!otmp || !in_ice_box(otmp)) - flags.move = multi = 0; -} - -static -struct monst * -bchit(ddx,ddy,range,sym) register int ddx,ddy,range; char sym; { - register struct monst *mtmp = (struct monst *) 0; - register int bchx = u.ux, bchy = u.uy; - - if(sym) Tmp_at(-1, sym); /* open call */ - while(range--) { - bchx += ddx; - bchy += ddy; - if(mtmp = m_at(bchx,bchy)) - break; - if(!ZAP_POS(levl[bchx][bchy].typ)) { - bchx -= ddx; - bchy -= ddy; - break; - } - if(sym) Tmp_at(bchx, bchy); - } - if(sym) Tmp_at(-1, -1); - return(mtmp); -} - -/* ARGSUSED */ -static void -use_whistle(obj) struct obj *obj; { -register struct monst *mtmp = fmon; - pline("You produce a high whistling sound."); - while(mtmp) { - if(dist(mtmp->mx,mtmp->my) < u.ulevel*20) { - if(mtmp->msleep) - mtmp->msleep = 0; - if(mtmp->mtame) - EDOG(mtmp)->whistletime = moves; - } - mtmp = mtmp->nmon; - } -} - -/* ARGSUSED */ -static void -use_magic_whistle(obj) struct obj *obj; { -register struct monst *mtmp = fmon; - pline("You produce a strange whistling sound."); - while(mtmp) { - if(mtmp->mtame) mnexto(mtmp); - mtmp = mtmp->nmon; - } -} - -static int dig_effort; /* effort expended on current pos */ -static uchar dig_level; -static coord dig_pos; -static boolean dig_down; - -static -dig() { - register struct rm *lev; - register dpx = dig_pos.x, dpy = dig_pos.y; - - /* perhaps a nymph stole his pick-axe while he was busy digging */ - /* or perhaps he teleported away */ - if(u.uswallow || !uwep || uwep->otyp != PICK_AXE || - dig_level != dlevel || - ((dig_down && (dpx != u.ux || dpy != u.uy)) || - (!dig_down && dist(dpx,dpy) > 2))) - return(0); - - dig_effort += 10 + abon() + uwep->spe + rn2(5); - if(dig_down) { - if(!xdnstair) { - pline("The floor here seems too hard to dig in."); - return(0); - } - if(dig_effort > 250) { - dighole(); - return(0); /* done with digging */ - } - if(dig_effort > 50) { - register struct trap *ttmp = t_at(dpx,dpy); - - if(!ttmp) { - ttmp = maketrap(dpx,dpy,PIT); - ttmp->tseen = 1; - pline("You have dug a pit."); - u.utrap = rn1(4,2); - u.utraptype = TT_PIT; - return(0); - } - } - } else - if(dig_effort > 100) { - register char *digtxt; - register struct obj *obj; - - lev = &levl[dpx][dpy]; - if(obj = sobj_at(ENORMOUS_ROCK, dpx, dpy)) { - fracture_rock(obj); - digtxt = "The rock falls apart."; - } else if(!lev->typ || lev->typ == SCORR) { - lev->typ = CORR; - digtxt = "You succeeded in cutting away some rock."; - } else if(lev->typ == HWALL || lev->typ == VWALL - || lev->typ == SDOOR) { - lev->typ = xdnstair ? DOOR : ROOM; - digtxt = "You just made an opening in the wall."; - } else - digtxt = "Now what exactly was it that you were digging in?"; - mnewsym(dpx, dpy); - prl(dpx, dpy); - pline(digtxt); /* after mnewsym & prl */ - return(0); - } else { - if(IS_WALL(levl[dpx][dpy].typ)) { - register int rno = inroom(dpx,dpy); - - if(rno >= 0 && rooms[rno].rtype >= 8) { - pline("This wall seems too hard to dig into."); - return(0); - } - } - pline("You hit the rock with all your might."); - } - return(1); -} - -/* When will hole be finished? Very rough indication used by shopkeeper. */ -holetime() { - return( (occupation == dig) ? (250 - dig_effort)/20 : -1); -} - -dighole() -{ - register struct trap *ttmp = t_at(u.ux, u.uy); - - if(!xdnstair) { - pline("The floor here seems too hard to dig in."); - } else { - if(ttmp) - ttmp->ttyp = TRAPDOOR; - else - ttmp = maketrap(u.ux, u.uy, TRAPDOOR); - ttmp->tseen = 1; - pline("You've made a hole in the floor."); - if(!u.ustuck) { - if(inshop()) - shopdig(1); - pline("You fall through ..."); - if(u.utraptype == TT_PIT) { - u.utrap = 0; - u.utraptype = 0; - } - goto_level(dlevel+1, FALSE); - } - } -} - -static -use_pick_axe(obj) -struct obj *obj; -{ - char dirsyms[12]; - extern char sdir[]; - register char *dsp = dirsyms, *sdp = sdir; - register struct monst *mtmp; - register struct rm *lev; - register int rx, ry, res = 0; - - if(obj != uwep) { - if(uwep && uwep->cursed) { - /* Andreas Bormann - ihnp4!decvax!mcvax!unido!ab */ - pline("Since your weapon is welded to your hand,"); - pline("you cannot use that pick-axe."); - return(0); - } - pline("You now wield %s.", doname(obj)); - setuwep(obj); - res = 1; - } - while(*sdp) { - (void) movecmd(*sdp); /* sets u.dx and u.dy and u.dz */ - rx = u.ux + u.dx; - ry = u.uy + u.dy; - if(u.dz > 0 || (u.dz == 0 && isok(rx, ry) && - (IS_ROCK(levl[rx][ry].typ) - || sobj_at(ENORMOUS_ROCK, rx, ry)))) - *dsp++ = *sdp; - sdp++; - } - *dsp = 0; - pline("In what direction do you want to dig? [%s] ", dirsyms); - if(!getdir(0)) /* no txt */ - return(res); - if(u.uswallow && attack(u.ustuck)) /* return(1) */; - else - if(u.dz < 0) - pline("You cannot reach the ceiling."); - else - if(u.dz == 0) { - if(Confusion) - confdir(); - rx = u.ux + u.dx; - ry = u.uy + u.dy; - if((mtmp = m_at(rx, ry)) && attack(mtmp)) - return(1); - if(!isok(rx, ry)) { - pline("Clash!"); - return(1); - } - lev = &levl[rx][ry]; - if(lev->typ == DOOR) - pline("Your %s against the door.", - aobjnam(obj, "clang")); - else if(!IS_ROCK(lev->typ) - && !sobj_at(ENORMOUS_ROCK, rx, ry)) { - /* ACCESSIBLE or POOL */ - pline("You swing your %s through thin air.", - aobjnam(obj, (char *) 0)); - } else { - if(dig_pos.x != rx || dig_pos.y != ry - || dig_level != dlevel || dig_down) { - dig_down = FALSE; - dig_pos.x = rx; - dig_pos.y = ry; - dig_level = dlevel; - dig_effort = 0; - pline("You start digging."); - } else - pline("You continue digging."); - occupation = dig; - occtxt = "digging"; - } - } else if(Levitation) { - pline("You cannot reach the floor."); - } else { - if(dig_pos.x != u.ux || dig_pos.y != u.uy - || dig_level != dlevel || !dig_down) { - dig_down = TRUE; - dig_pos.x = u.ux; - dig_pos.y = u.uy; - dig_level = dlevel; - dig_effort = 0; - pline("You start digging in the floor."); - if(inshop()) - shopdig(0); - } else - pline("You continue digging in the floor."); - occupation = dig; - occtxt = "digging"; - } - return(1); -} diff --git a/games/hack/hack.bones.c b/games/hack/hack.bones.c deleted file mode 100644 index d4a05b822212..000000000000 --- a/games/hack/hack.bones.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.bones.c - version 1.0.3 */ - -#include "hack.h" -extern char plname[PL_NSIZ]; -extern long somegold(); -extern struct monst *makemon(); -extern struct permonst pm_ghost; - -char bones[] = "bones_xx"; - -/* save bones and possessions of a deceased adventurer */ -savebones(){ -register fd; -register struct obj *otmp; -register struct trap *ttmp; -register struct monst *mtmp; - if(dlevel <= 0 || dlevel > MAXLEVEL) return; - if(!rn2(1 + dlevel/2)) return; /* not so many ghosts on low levels */ - bones[6] = '0' + (dlevel/10); - bones[7] = '0' + (dlevel%10); - if((fd = open(bones,0)) >= 0){ - (void) close(fd); - return; - } - /* drop everything; the corpse's possessions are usually cursed */ - otmp = invent; - while(otmp){ - otmp->ox = u.ux; - otmp->oy = u.uy; - otmp->age = 0; /* very long ago */ - otmp->owornmask = 0; - if(rn2(5)) otmp->cursed = 1; - if(!otmp->nobj){ - otmp->nobj = fobj; - fobj = invent; - invent = 0; /* superfluous */ - break; - } - otmp = otmp->nobj; - } - if(!(mtmp = makemon(PM_GHOST, u.ux, u.uy))) return; - mtmp->mx = u.ux; - mtmp->my = u.uy; - mtmp->msleep = 1; - (void) strcpy((char *) mtmp->mextra, plname); - mkgold(somegold() + d(dlevel,30), u.ux, u.uy); - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){ - mtmp->m_id = 0; - if(mtmp->mtame) { - mtmp->mtame = 0; - mtmp->mpeaceful = 0; - } - mtmp->mlstmv = 0; - if(mtmp->mdispl) unpmon(mtmp); - } - for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) - ttmp->tseen = 0; - for(otmp = fobj; otmp; otmp = otmp->nobj) { - otmp->o_id = 0; - /* otmp->o_cnt_id = 0; - superfluous */ - otmp->onamelth = 0; - otmp->known = 0; - otmp->invlet = 0; - if(otmp->olet == AMULET_SYM && !otmp->spe) { - otmp->spe = -1; /* no longer the actual amulet */ - otmp->cursed = 1; /* flag as gotten from a ghost */ - } - } - if((fd = creat(bones, FMASK)) < 0) return; - savelev(fd,dlevel); - (void) close(fd); -} - -getbones(){ -register fd,x,y,ok; - if(rn2(3)) return(0); /* only once in three times do we find bones */ - bones[6] = '0' + dlevel/10; - bones[7] = '0' + dlevel%10; - if((fd = open(bones, 0)) < 0) return(0); - if((ok = uptodate(fd)) != 0){ - getlev(fd, 0, dlevel); - for(x = 0; x < COLNO; x++) for(y = 0; y < ROWNO; y++) - levl[x][y].seen = levl[x][y].new = 0; - } - (void) close(fd); -#ifdef WIZARD - if(!wizard) /* duvel!frans: don't remove bones while debugging */ -#endif WiZARD - if(unlink(bones) < 0){ - pline("Cannot unlink %s .", bones); - return(0); - } - return(ok); -} diff --git a/games/hack/hack.c b/games/hack/hack.c deleted file mode 100644 index 5c8288144ed8..000000000000 --- a/games/hack/hack.c +++ /dev/null @@ -1,798 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.c - version 1.0.3 */ - -#include "hack.h" -#include - -extern char news0(); -extern char *nomovemsg; -extern char *exclam(); -extern struct obj *addinv(); -extern boolean hmon(); - -/* called on movement: - 1. when throwing ball+chain far away - 2. when teleporting - 3. when walking out of a lit room - */ -unsee() { - register x,y; - register struct rm *lev; - -/* - if(u.udispl){ - u.udispl = 0; - newsym(u.udisx, u.udisy); - } -*/ -#ifndef QUEST - if(seehx){ - seehx = 0; - } else -#endif QUEST - for(x = u.ux-1; x < u.ux+2; x++) - for(y = u.uy-1; y < u.uy+2; y++) { - if(!isok(x, y)) continue; - lev = &levl[x][y]; - if(!lev->lit && lev->scrsym == '.') { - lev->scrsym =' '; - lev->new = 1; - on_scr(x,y); - } - } -} - -/* called: - in hack.eat.c: seeoff(0) - blind after eating rotten food - in hack.mon.c: seeoff(0) - blinded by a yellow light - in hack.mon.c: seeoff(1) - swallowed - in hack.do.c: seeoff(0) - blind after drinking potion - in hack.do.c: seeoff(1) - go up or down the stairs - in hack.trap.c:seeoff(1) - fall through trapdoor - */ -seeoff(mode) /* 1 to redo @, 0 to leave them */ -{ /* 1 means misc movement, 0 means blindness */ - register x,y; - register struct rm *lev; - - if(u.udispl && mode){ - u.udispl = 0; - levl[u.udisx][u.udisy].scrsym = news0(u.udisx,u.udisy); - } -#ifndef QUEST - if(seehx) { - seehx = 0; - } else -#endif QUEST - if(!mode) { - for(x = u.ux-1; x < u.ux+2; x++) - for(y = u.uy-1; y < u.uy+2; y++) { - if(!isok(x, y)) continue; - lev = &levl[x][y]; - if(!lev->lit && lev->scrsym == '.') - lev->seen = 0; - } - } -} - -domove() -{ - xchar oldx,oldy; - register struct monst *mtmp; - register struct rm *tmpr,*ust; - struct trap *trap; - register struct obj *otmp; - - u_wipe_engr(rnd(5)); - - if(inv_weight() > 0){ - pline("You collapse under your load."); - nomul(0); - return; - } - if(u.uswallow) { - u.dx = u.dy = 0; - u.ux = u.ustuck->mx; - u.uy = u.ustuck->my; - } else { - if(Confusion) { - do { - confdir(); - } while(!isok(u.ux+u.dx, u.uy+u.dy) || - IS_ROCK(levl[u.ux+u.dx][u.uy+u.dy].typ)); - } - if(!isok(u.ux+u.dx, u.uy+u.dy)){ - nomul(0); - return; - } - } - - ust = &levl[u.ux][u.uy]; - oldx = u.ux; - oldy = u.uy; - if(!u.uswallow && (trap = t_at(u.ux+u.dx, u.uy+u.dy)) && trap->tseen) - nomul(0); - if(u.ustuck && !u.uswallow && (u.ux+u.dx != u.ustuck->mx || - u.uy+u.dy != u.ustuck->my)) { - if(dist(u.ustuck->mx, u.ustuck->my) > 2){ - /* perhaps it fled (or was teleported or ... ) */ - u.ustuck = 0; - } else { - if(Blind) pline("You cannot escape from it!"); - else pline("You cannot escape from %s!", - monnam(u.ustuck)); - nomul(0); - return; - } - } - if(u.uswallow || (mtmp = m_at(u.ux+u.dx,u.uy+u.dy))) { - /* attack monster */ - - nomul(0); - gethungry(); - if(multi < 0) return; /* we just fainted */ - - /* try to attack; note that it might evade */ - if(attack(u.uswallow ? u.ustuck : mtmp)) - return; - } - /* not attacking an animal, so we try to move */ - if(u.utrap) { - if(u.utraptype == TT_PIT) { - pline("You are still in a pit."); - u.utrap--; - } else { - pline("You are caught in a beartrap."); - if((u.dx && u.dy) || !rn2(5)) u.utrap--; - } - return; - } - tmpr = &levl[u.ux+u.dx][u.uy+u.dy]; - if(IS_ROCK(tmpr->typ) || - (u.dx && u.dy && (tmpr->typ == DOOR || ust->typ == DOOR))){ - flags.move = 0; - nomul(0); - return; - } - while(otmp = sobj_at(ENORMOUS_ROCK, u.ux+u.dx, u.uy+u.dy)) { - register xchar rx = u.ux+2*u.dx, ry = u.uy+2*u.dy; - register struct trap *ttmp; - nomul(0); - if(isok(rx,ry) && !IS_ROCK(levl[rx][ry].typ) && - (levl[rx][ry].typ != DOOR || !(u.dx && u.dy)) && - !sobj_at(ENORMOUS_ROCK, rx, ry)) { - if(m_at(rx,ry)) { - pline("You hear a monster behind the rock."); - pline("Perhaps that's why you cannot move it."); - goto cannot_push; - } - if(ttmp = t_at(rx,ry)) - switch(ttmp->ttyp) { - case PIT: - pline("You push the rock into a pit!"); - deltrap(ttmp); - delobj(otmp); - pline("It completely fills the pit!"); - continue; - case TELEP_TRAP: - pline("You push the rock and suddenly it disappears!"); - delobj(otmp); - continue; - } - if(levl[rx][ry].typ == POOL) { - levl[rx][ry].typ = ROOM; - mnewsym(rx,ry); - prl(rx,ry); - pline("You push the rock into the water."); - pline("Now you can cross the water!"); - delobj(otmp); - continue; - } - otmp->ox = rx; - otmp->oy = ry; - /* pobj(otmp); */ - if(cansee(rx,ry)) atl(rx,ry,otmp->olet); - if(Invisible) newsym(u.ux+u.dx, u.uy+u.dy); - - { static long lastmovetime; - /* note: this var contains garbage initially and - after a restore */ - if(moves > lastmovetime+2 || moves < lastmovetime) - pline("With great effort you move the enormous rock."); - lastmovetime = moves; - } - } else { - pline("You try to move the enormous rock, but in vain."); - cannot_push: - if((!invent || inv_weight()+90 <= 0) && - (!u.dx || !u.dy || (IS_ROCK(levl[u.ux][u.uy+u.dy].typ) - && IS_ROCK(levl[u.ux+u.dx][u.uy].typ)))){ - pline("However, you can squeeze yourself into a small opening."); - break; - } else - return; - } - } - if(u.dx && u.dy && IS_ROCK(levl[u.ux][u.uy+u.dy].typ) && - IS_ROCK(levl[u.ux+u.dx][u.uy].typ) && - invent && inv_weight()+40 > 0) { - pline("You are carrying too much to get through."); - nomul(0); - return; - } - if(Punished && - DIST(u.ux+u.dx, u.uy+u.dy, uchain->ox, uchain->oy) > 2){ - if(carried(uball)) { - movobj(uchain, u.ux, u.uy); - goto nodrag; - } - - if(DIST(u.ux+u.dx, u.uy+u.dy, uball->ox, uball->oy) < 3){ - /* leave ball, move chain under/over ball */ - movobj(uchain, uball->ox, uball->oy); - goto nodrag; - } - - if(inv_weight() + (int) uball->owt/2 > 0) { - pline("You cannot %sdrag the heavy iron ball.", - invent ? "carry all that and also " : ""); - nomul(0); - return; - } - - movobj(uball, uchain->ox, uchain->oy); - unpobj(uball); /* BAH %% */ - uchain->ox = u.ux; - uchain->oy = u.uy; - nomul(-2); - nomovemsg = ""; - nodrag: ; - } - u.ux += u.dx; - u.uy += u.dy; - if(flags.run) { - if(tmpr->typ == DOOR || - (xupstair == u.ux && yupstair == u.uy) || - (xdnstair == u.ux && ydnstair == u.uy)) - nomul(0); - } - - if(tmpr->typ == POOL && !Levitation) - drown(); /* not necessarily fatal */ - -/* - if(u.udispl) { - u.udispl = 0; - newsym(oldx,oldy); - } -*/ - if(!Blind) { -#ifdef QUEST - setsee(); -#else - if(ust->lit) { - if(tmpr->lit) { - if(tmpr->typ == DOOR) - prl1(u.ux+u.dx,u.uy+u.dy); - else if(ust->typ == DOOR) - nose1(oldx-u.dx,oldy-u.dy); - } else { - unsee(); - prl1(u.ux+u.dx,u.uy+u.dy); - } - } else { - if(tmpr->lit) setsee(); - else { - prl1(u.ux+u.dx,u.uy+u.dy); - if(tmpr->typ == DOOR) { - if(u.dy) { - prl(u.ux-1,u.uy); - prl(u.ux+1,u.uy); - } else { - prl(u.ux,u.uy-1); - prl(u.ux,u.uy+1); - } - } - } - nose1(oldx-u.dx,oldy-u.dy); - } -#endif QUEST - } else { - pru(); - } - if(!flags.nopick) pickup(1); - if(trap) dotrap(trap); /* fall into pit, arrow trap, etc. */ - (void) inshop(); - if(!Blind) read_engr_at(u.ux,u.uy); -} - -movobj(obj, ox, oy) -register struct obj *obj; -register int ox, oy; -{ - /* Some dirty programming to get display right */ - freeobj(obj); - unpobj(obj); - obj->nobj = fobj; - fobj = obj; - obj->ox = ox; - obj->oy = oy; -} - -dopickup(){ - if(!g_at(u.ux,u.uy) && !o_at(u.ux,u.uy)) { - pline("There is nothing here to pick up."); - return(0); - } - if(Levitation) { - pline("You cannot reach the floor."); - return(1); - } - pickup(0); - return(1); -} - -pickup(all) -{ - register struct gold *gold; - register struct obj *obj, *obj2; - register int wt; - - if(Levitation) return; - while(gold = g_at(u.ux,u.uy)) { - pline("%ld gold piece%s.", gold->amount, plur(gold->amount)); - u.ugold += gold->amount; - flags.botl = 1; - freegold(gold); - if(flags.run) nomul(0); - if(Invisible) newsym(u.ux,u.uy); - } - - /* check for more than one object */ - if(!all) { - register int ct = 0; - - for(obj = fobj; obj; obj = obj->nobj) - if(obj->ox == u.ux && obj->oy == u.uy) - if(!Punished || obj != uchain) - ct++; - if(ct < 2) - all++; - else - pline("There are several objects here."); - } - - for(obj = fobj; obj; obj = obj2) { - obj2 = obj->nobj; /* perhaps obj will be picked up */ - if(obj->ox == u.ux && obj->oy == u.uy) { - if(flags.run) nomul(0); - - /* do not pick up uchain */ - if(Punished && obj == uchain) - continue; - - if(!all) { - char c; - - pline("Pick up %s ? [ynaq]", doname(obj)); - while(!index("ynaq ", (c = readchar()))) - bell(); - if(c == 'q') return; - if(c == 'n') continue; - if(c == 'a') all = 1; - } - - if(obj->otyp == DEAD_COCKATRICE && !uarmg){ - pline("Touching the dead cockatrice is a fatal mistake."); - pline("You turn to stone."); - killer = "cockatrice cadaver"; - done("died"); - } - - if(obj->otyp == SCR_SCARE_MONSTER){ - if(!obj->spe) obj->spe = 1; - else { - /* Note: perhaps the 1st pickup failed: you cannot - carry anymore, and so we never dropped it - - let's assume that treading on it twice also - destroys the scroll */ - pline("The scroll turns to dust as you pick it up."); - delobj(obj); - continue; - } - } - - wt = inv_weight() + obj->owt; - if(wt > 0) { - if(obj->quan > 1) { - /* see how many we can lift */ - extern struct obj *splitobj(); - int savequan = obj->quan; - int iw = inv_weight(); - int qq; - for(qq = 1; qq < savequan; qq++){ - obj->quan = qq; - if(iw + weight(obj) > 0) - break; - } - obj->quan = savequan; - qq--; - /* we can carry qq of them */ - if(!qq) goto too_heavy; - pline("You can only carry %s of the %s lying here.", - (qq == 1) ? "one" : "some", - doname(obj)); - (void) splitobj(obj, qq); - /* note: obj2 is set already, so we'll never - * encounter the other half; if it should be - * otherwise then write - * obj2 = splitobj(obj,qq); - */ - goto lift_some; - } - too_heavy: - pline("There %s %s here, but %s.", - (obj->quan == 1) ? "is" : "are", - doname(obj), - !invent ? "it is too heavy for you to lift" - : "you cannot carry anymore"); - break; - } - lift_some: - if(inv_cnt() >= 52) { - pline("Your knapsack cannot accomodate anymore items."); - break; - } - if(wt > -5) pline("You have a little trouble lifting"); - freeobj(obj); - if(Invisible) newsym(u.ux,u.uy); - addtobill(obj); /* sets obj->unpaid if necessary */ - { int pickquan = obj->quan; - int mergquan; - if(!Blind) obj->dknown = 1; /* this is done by prinv(), - but addinv() needs it already for merging */ - obj = addinv(obj); /* might merge it with other objects */ - mergquan = obj->quan; - obj->quan = pickquan; /* to fool prinv() */ - prinv(obj); - obj->quan = mergquan; - } - } - } -} - -/* stop running if we see something interesting */ -/* turn around a corner if that is the only way we can proceed */ -/* do not turn left or right twice */ -lookaround(){ -register x,y,i,x0,y0,m0,i0 = 9; -register int corrct = 0, noturn = 0; -register struct monst *mtmp; -#ifdef lint - /* suppress "used before set" message */ - x0 = y0 = 0; -#endif lint - if(Blind || flags.run == 0) return; - if(flags.run == 1 && levl[u.ux][u.uy].typ == ROOM) return; -#ifdef QUEST - if(u.ux0 == u.ux+u.dx && u.uy0 == u.uy+u.dy) goto stop; -#endif QUEST - for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){ - if(x == u.ux && y == u.uy) continue; - if(!levl[x][y].typ) continue; - if((mtmp = m_at(x,y)) && !mtmp->mimic && - (!mtmp->minvis || See_invisible)){ - if(!mtmp->mtame || (x == u.ux+u.dx && y == u.uy+u.dy)) - goto stop; - } else mtmp = 0; /* invisible M cannot influence us */ - if(x == u.ux-u.dx && y == u.uy-u.dy) continue; - switch(levl[x][y].scrsym){ - case '|': - case '-': - case '.': - case ' ': - break; - case '+': - if(x != u.ux && y != u.uy) break; - if(flags.run != 1) goto stop; - /* fall into next case */ - case CORR_SYM: - corr: - if(flags.run == 1 || flags.run == 3) { - i = DIST(x,y,u.ux+u.dx,u.uy+u.dy); - if(i > 2) break; - if(corrct == 1 && DIST(x,y,x0,y0) != 1) - noturn = 1; - if(i < i0) { - i0 = i; - x0 = x; - y0 = y; - m0 = mtmp ? 1 : 0; - } - } - corrct++; - break; - case '^': - if(flags.run == 1) goto corr; /* if you must */ - if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop; - break; - default: /* e.g. objects or trap or stairs */ - if(flags.run == 1) goto corr; - if(mtmp) break; /* d */ - stop: - nomul(0); - return; - } - } -#ifdef QUEST - if(corrct > 0 && (flags.run == 4 || flags.run == 5)) goto stop; -#endif QUEST - if(corrct > 1 && flags.run == 2) goto stop; - if((flags.run == 1 || flags.run == 3) && !noturn && !m0 && i0 && - (corrct == 1 || (corrct == 2 && i0 == 1))) { - /* make sure that we do not turn too far */ - if(i0 == 2) { - if(u.dx == y0-u.uy && u.dy == u.ux-x0) - i = 2; /* straight turn right */ - else - i = -2; /* straight turn left */ - } else if(u.dx && u.dy) { - if((u.dx == u.dy && y0 == u.uy) || - (u.dx != u.dy && y0 != u.uy)) - i = -1; /* half turn left */ - else - i = 1; /* half turn right */ - } else { - if((x0-u.ux == y0-u.uy && !u.dy) || - (x0-u.ux != y0-u.uy && u.dy)) - i = 1; /* half turn right */ - else - i = -1; /* half turn left */ - } - i += u.last_str_turn; - if(i <= 2 && i >= -2) { - u.last_str_turn = i; - u.dx = x0-u.ux, u.dy = y0-u.uy; - } - } -} - -/* something like lookaround, but we are not running */ -/* react only to monsters that might hit us */ -monster_nearby() { -register int x,y; -register struct monst *mtmp; - if(!Blind) - for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){ - if(x == u.ux && y == u.uy) continue; - if((mtmp = m_at(x,y)) && !mtmp->mimic && !mtmp->mtame && - !mtmp->mpeaceful && !index("Ea", mtmp->data->mlet) && - !mtmp->mfroz && !mtmp->msleep && /* aplvax!jcn */ - (!mtmp->minvis || See_invisible)) - return(1); - } - return(0); -} - -#ifdef QUEST -cansee(x,y) xchar x,y; { -register int dx,dy,adx,ady,sdx,sdy,dmax,d; - if(Blind) return(0); - if(!isok(x,y)) return(0); - d = dist(x,y); - if(d < 3) return(1); - if(d > u.uhorizon*u.uhorizon) return(0); - if(!levl[x][y].lit) - return(0); - dx = x - u.ux; adx = abs(dx); sdx = sgn(dx); - dy = y - u.uy; ady = abs(dy); sdy = sgn(dy); - if(dx == 0 || dy == 0 || adx == ady){ - dmax = (dx == 0) ? ady : adx; - for(d = 1; d <= dmax; d++) - if(!rroom(sdx*d,sdy*d)) - return(0); - return(1); - } else if(ady > adx){ - for(d = 1; d <= ady; d++){ - if(!rroom(sdx*( (d*adx)/ady ), sdy*d) || - !rroom(sdx*( (d*adx-1)/ady+1 ), sdy*d)) - return(0); - } - return(1); - } else { - for(d = 1; d <= adx; d++){ - if(!rroom(sdx*d, sdy*( (d*ady)/adx )) || - !rroom(sdx*d, sdy*( (d*ady-1)/adx+1 ))) - return(0); - } - return(1); - } -} - -rroom(x,y) register int x,y; { - return(IS_ROOM(levl[u.ux+x][u.uy+y].typ)); -} - -#else - -cansee(x,y) xchar x,y; { - if(Blind || u.uswallow) return(0); - if(dist(x,y) < 3) return(1); - if(levl[x][y].lit && seelx <= x && x <= seehx && seely <= y && - y <= seehy) return(1); - return(0); -} -#endif QUEST - -sgn(a) register int a; { - return((a > 0) ? 1 : (a == 0) ? 0 : -1); -} - -#ifdef QUEST -setsee() -{ - register x,y; - - if(Blind) { - pru(); - return; - } - for(y = u.uy-u.uhorizon; y <= u.uy+u.uhorizon; y++) - for(x = u.ux-u.uhorizon; x <= u.ux+u.uhorizon; x++) { - if(cansee(x,y)) - prl(x,y); - } -} - -#else - -setsee() -{ - register x,y; - - if(Blind) { - pru(); - return; - } - if(!levl[u.ux][u.uy].lit) { - seelx = u.ux-1; - seehx = u.ux+1; - seely = u.uy-1; - seehy = u.uy+1; - } else { - for(seelx = u.ux; levl[seelx-1][u.uy].lit; seelx--); - for(seehx = u.ux; levl[seehx+1][u.uy].lit; seehx++); - for(seely = u.uy; levl[u.ux][seely-1].lit; seely--); - for(seehy = u.uy; levl[u.ux][seehy+1].lit; seehy++); - } - for(y = seely; y <= seehy; y++) - for(x = seelx; x <= seehx; x++) { - prl(x,y); - } - if(!levl[u.ux][u.uy].lit) seehx = 0; /* seems necessary elsewhere */ - else { - if(seely == u.uy) for(x = u.ux-1; x <= u.ux+1; x++) prl(x,seely-1); - if(seehy == u.uy) for(x = u.ux-1; x <= u.ux+1; x++) prl(x,seehy+1); - if(seelx == u.ux) for(y = u.uy-1; y <= u.uy+1; y++) prl(seelx-1,y); - if(seehx == u.ux) for(y = u.uy-1; y <= u.uy+1; y++) prl(seehx+1,y); - } -} -#endif QUEST - -nomul(nval) -register nval; -{ - if(multi < 0) return; - multi = nval; - flags.mv = flags.run = 0; -} - -abon() -{ - if(u.ustr == 3) return(-3); - else if(u.ustr < 6) return(-2); - else if(u.ustr < 8) return(-1); - else if(u.ustr < 17) return(0); - else if(u.ustr < 69) return(1); /* up to 18/50 */ - else if(u.ustr < 118) return(2); - else return(3); -} - -dbon() -{ - if(u.ustr < 6) return(-1); - else if(u.ustr < 16) return(0); - else if(u.ustr < 18) return(1); - else if(u.ustr == 18) return(2); /* up to 18 */ - else if(u.ustr < 94) return(3); /* up to 18/75 */ - else if(u.ustr < 109) return(4); /* up to 18/90 */ - else if(u.ustr < 118) return(5); /* up to 18/99 */ - else return(6); -} - -losestr(num) /* may kill you; cause may be poison or monster like 'A' */ -register num; -{ - u.ustr -= num; - while(u.ustr < 3) { - u.ustr++; - u.uhp -= 6; - u.uhpmax -= 6; - } - flags.botl = 1; -} - -losehp(n,knam) -register n; -register char *knam; -{ - u.uhp -= n; - if(u.uhp > u.uhpmax) - u.uhpmax = u.uhp; /* perhaps n was negative */ - flags.botl = 1; - if(u.uhp < 1) { - killer = knam; /* the thing that killed you */ - done("died"); - } -} - -losehp_m(n,mtmp) -register n; -register struct monst *mtmp; -{ - u.uhp -= n; - flags.botl = 1; - if(u.uhp < 1) - done_in_by(mtmp); -} - -losexp() /* hit by V or W */ -{ - register num; - extern long newuexp(); - - if(u.ulevel > 1) - pline("Goodbye level %u.", u.ulevel--); - else - u.uhp = -1; - num = rnd(10); - u.uhp -= num; - u.uhpmax -= num; - u.uexp = newuexp(); - flags.botl = 1; -} - -inv_weight(){ -register struct obj *otmp = invent; -register int wt = (u.ugold + 500)/1000; -register int carrcap; - if(Levitation) /* pugh@cornell */ - carrcap = MAX_CARR_CAP; - else { - carrcap = 5*(((u.ustr > 18) ? 20 : u.ustr) + u.ulevel); - if(carrcap > MAX_CARR_CAP) carrcap = MAX_CARR_CAP; - if(Wounded_legs & LEFT_SIDE) carrcap -= 10; - if(Wounded_legs & RIGHT_SIDE) carrcap -= 10; - } - while(otmp){ - wt += otmp->owt; - otmp = otmp->nobj; - } - return(wt - carrcap); -} - -inv_cnt(){ -register struct obj *otmp = invent; -register int ct = 0; - while(otmp){ - ct++; - otmp = otmp->nobj; - } - return(ct); -} - -long -newuexp() -{ - return(10*(1L << (u.ulevel-1))); -} diff --git a/games/hack/hack.cmd.c b/games/hack/hack.cmd.c deleted file mode 100644 index e36cfcca9d66..000000000000 --- a/games/hack/hack.cmd.c +++ /dev/null @@ -1,302 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.cmd.c - version 1.0.3 */ - -#include "hack.h" -#include "def.func_tab.h" - -int doredraw(),doredotopl(),dodrop(),dodrink(),doread(),dosearch(),dopickup(), -doversion(),doweararm(),dowearring(),doremarm(),doremring(),dopay(),doapply(), -dosave(),dowield(),ddoinv(),dozap(),ddocall(),dowhatis(),doengrave(),dotele(), -dohelp(),doeat(),doddrop(),do_mname(),doidtrap(),doprwep(),doprarm(), -doprring(),doprgold(),dodiscovered(),dotypeinv(),dolook(),doset(), -doup(), dodown(), done1(), donull(), dothrow(), doextcmd(), dodip(), dopray(); -#ifdef SHELL -int dosh(); -#endif SHELL -#ifdef SUSPEND -int dosuspend(); -#endif SUSPEND - -struct func_tab cmdlist[]={ - '\020', doredotopl, - '\022', doredraw, - '\024', dotele, -#ifdef SUSPEND - '\032', dosuspend, -#endif SUSPEND - 'a', doapply, -/* 'A' : UNUSED */ -/* 'b', 'B' : go sw */ - 'c', ddocall, - 'C', do_mname, - 'd', dodrop, - 'D', doddrop, - 'e', doeat, - 'E', doengrave, -/* 'f', 'F' : multiple go (might become 'fight') */ -/* 'g', 'G' : UNUSED */ -/* 'h', 'H' : go west */ - 'I', dotypeinv, /* Robert Viduya */ - 'i', ddoinv, -/* 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N' : move commands */ -/* 'o', doopen, */ - 'O', doset, - 'p', dopay, - 'P', dowearring, - 'q', dodrink, - 'Q', done1, - 'r', doread, - 'R', doremring, - 's', dosearch, - 'S', dosave, - 't', dothrow, - 'T', doremarm, -/* 'u', 'U' : go ne */ - 'v', doversion, -/* 'V' : UNUSED */ - 'w', dowield, - 'W', doweararm, -/* 'x', 'X' : UNUSED */ -/* 'y', 'Y' : go nw */ - 'z', dozap, -/* 'Z' : UNUSED */ - '<', doup, - '>', dodown, - '/', dowhatis, - '?', dohelp, -#ifdef SHELL - '!', dosh, -#endif SHELL - '.', donull, - ' ', donull, - ',', dopickup, - ':', dolook, - '^', doidtrap, - '\\', dodiscovered, /* Robert Viduya */ - WEAPON_SYM, doprwep, - ARMOR_SYM, doprarm, - RING_SYM, doprring, - '$', doprgold, - '#', doextcmd, - 0,0,0 -}; - -struct ext_func_tab extcmdlist[] = { - "dip", dodip, - "pray", dopray, - (char *) 0, donull -}; - -extern char *parse(), lowc(), unctrl(), quitchars[]; - -rhack(cmd) -register char *cmd; -{ - register struct func_tab *tlist = cmdlist; - boolean firsttime = FALSE; - register res; - - if(!cmd) { - firsttime = TRUE; - flags.nopick = 0; - cmd = parse(); - } - if(!*cmd || (*cmd & 0377) == 0377 || - (flags.no_rest_on_space && *cmd == ' ')){ - bell(); - flags.move = 0; - return; /* probably we just had an interrupt */ - } - if(movecmd(*cmd)) { - walk: - if(multi) flags.mv = 1; - domove(); - return; - } - if(movecmd(lowc(*cmd))) { - flags.run = 1; - rush: - if(firsttime){ - if(!multi) multi = COLNO; - u.last_str_turn = 0; - } - flags.mv = 1; -#ifdef QUEST - if(flags.run >= 4) finddir(); - if(firsttime){ - u.ux0 = u.ux + u.dx; - u.uy0 = u.uy + u.dy; - } -#endif QUEST - domove(); - return; - } - if((*cmd == 'f' && movecmd(cmd[1])) || movecmd(unctrl(*cmd))) { - flags.run = 2; - goto rush; - } - if(*cmd == 'F' && movecmd(lowc(cmd[1]))) { - flags.run = 3; - goto rush; - } - if(*cmd == 'm' && movecmd(cmd[1])) { - flags.run = 0; - flags.nopick = 1; - goto walk; - } - if(*cmd == 'M' && movecmd(lowc(cmd[1]))) { - flags.run = 1; - flags.nopick = 1; - goto rush; - } -#ifdef QUEST - if(*cmd == cmd[1] && (*cmd == 'f' || *cmd == 'F')) { - flags.run = 4; - if(*cmd == 'F') flags.run += 2; - if(cmd[2] == '-') flags.run += 1; - goto rush; - } -#endif QUEST - while(tlist->f_char) { - if(*cmd == tlist->f_char){ - res = (*(tlist->f_funct))(); - if(!res) { - flags.move = 0; - multi = 0; - } - return; - } - tlist++; - } - { char expcmd[10]; - register char *cp = expcmd; - while(*cmd && cp-expcmd < sizeof(expcmd)-2) { - if(*cmd >= 040 && *cmd < 0177) - *cp++ = *cmd++; - else { - *cp++ = '^'; - *cp++ = *cmd++ ^ 0100; - } - } - *cp++ = 0; - pline("Unknown command '%s'.", expcmd); - } - multi = flags.move = 0; -} - -doextcmd() /* here after # - now read a full-word command */ -{ - char buf[BUFSZ]; - register struct ext_func_tab *efp = extcmdlist; - - pline("# "); - getlin(buf); - clrlin(); - if(buf[0] == '\033') - return(0); - while(efp->ef_txt) { - if(!strcmp(efp->ef_txt, buf)) - return((*(efp->ef_funct))()); - efp++; - } - pline("%s: unknown command.", buf); - return(0); -} - -char -lowc(sym) -char sym; -{ - return( (sym >= 'A' && sym <= 'Z') ? sym+'a'-'A' : sym ); -} - -char -unctrl(sym) -char sym; -{ - return( (sym >= ('A' & 037) && sym <= ('Z' & 037)) ? sym + 0140 : sym ); -} - -/* 'rogue'-like direction commands */ -char sdir[] = "hykulnjb><"; -schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 }; -schar ydir[10] = { 0,-1,-1,-1, 0, 1, 1, 1, 0, 0 }; -schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1,-1 }; - -movecmd(sym) /* also sets u.dz, but returns false for <> */ -char sym; -{ - register char *dp; - - u.dz = 0; - if(!(dp = index(sdir, sym))) return(0); - u.dx = xdir[dp-sdir]; - u.dy = ydir[dp-sdir]; - u.dz = zdir[dp-sdir]; - return(!u.dz); -} - -getdir(s) -boolean s; -{ - char dirsym; - - if(s) pline("In what direction?"); - dirsym = readchar(); - if(!movecmd(dirsym) && !u.dz) { - if(!index(quitchars, dirsym)) - pline("What a strange direction!"); - return(0); - } - if(Confusion && !u.dz) - confdir(); - return(1); -} - -confdir() -{ - register x = rn2(8); - u.dx = xdir[x]; - u.dy = ydir[x]; -} - -#ifdef QUEST -finddir(){ -register int i, ui = u.di; - for(i = 0; i <= 8; i++){ - if(flags.run & 1) ui++; else ui += 7; - ui %= 8; - if(i == 8){ - pline("Not near a wall."); - flags.move = multi = 0; - return(0); - } - if(!isroom(u.ux+xdir[ui], u.uy+ydir[ui])) - break; - } - for(i = 0; i <= 8; i++){ - if(flags.run & 1) ui += 7; else ui++; - ui %= 8; - if(i == 8){ - pline("Not near a room."); - flags.move = multi = 0; - return(0); - } - if(isroom(u.ux+xdir[ui], u.uy+ydir[ui])) - break; - } - u.di = ui; - u.dx = xdir[ui]; - u.dy = ydir[ui]; -} - -isroom(x,y) register x,y; { /* what about POOL? */ - return(isok(x,y) && (levl[x][y].typ == ROOM || - (levl[x][y].typ >= LDOOR && flags.run >= 6))); -} -#endif QUEST - -isok(x,y) register x,y; { - /* x corresponds to curx, so x==1 is the first column. Ach. %% */ - return(x >= 1 && x <= COLNO-1 && y >= 0 && y <= ROWNO-1); -} diff --git a/games/hack/hack.do.c b/games/hack/hack.do.c deleted file mode 100644 index 1227eb923dd8..000000000000 --- a/games/hack/hack.do.c +++ /dev/null @@ -1,488 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.do.c - version 1.0.3 */ - -/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */ - -#include "hack.h" - -extern struct obj *splitobj(), *addinv(); -extern boolean hmon(); -extern boolean level_exists[]; -extern struct monst youmonst; -extern char *Doname(); -extern char *nomovemsg; - -static int drop(); - -dodrop() { - return(drop(getobj("0$#", "drop"))); -} - -static int -drop(obj) register struct obj *obj; { - if(!obj) return(0); - if(obj->olet == '$') { /* pseudo object */ - register long amount = OGOLD(obj); - - if(amount == 0) - pline("You didn't drop any gold pieces."); - else { - mkgold(amount, u.ux, u.uy); - pline("You dropped %ld gold piece%s.", - amount, plur(amount)); - if(Invisible) newsym(u.ux, u.uy); - } - free((char *) obj); - return(1); - } - if(obj->owornmask & (W_ARMOR | W_RING)){ - pline("You cannot drop something you are wearing."); - return(0); - } - if(obj == uwep) { - if(uwep->cursed) { - pline("Your weapon is welded to your hand!"); - return(0); - } - setuwep((struct obj *) 0); - } - pline("You dropped %s.", doname(obj)); - dropx(obj); - return(1); -} - -/* Called in several places - should not produce texts */ -dropx(obj) -register struct obj *obj; -{ - freeinv(obj); - dropy(obj); -} - -dropy(obj) -register struct obj *obj; -{ - if(obj->otyp == CRYSKNIFE) - obj->otyp = WORM_TOOTH; - obj->ox = u.ux; - obj->oy = u.uy; - obj->nobj = fobj; - fobj = obj; - if(Invisible) newsym(u.ux,u.uy); - subfrombill(obj); - stackobj(obj); -} - -/* drop several things */ -doddrop() { - return(ggetobj("drop", drop, 0)); -} - -dodown() -{ - if(u.ux != xdnstair || u.uy != ydnstair) { - pline("You can't go down here."); - return(0); - } - if(u.ustuck) { - pline("You are being held, and cannot go down."); - return(1); - } - if(Levitation) { - pline("You're floating high above the stairs."); - return(0); - } - - goto_level(dlevel+1, TRUE); - return(1); -} - -doup() -{ - if(u.ux != xupstair || u.uy != yupstair) { - pline("You can't go up here."); - return(0); - } - if(u.ustuck) { - pline("You are being held, and cannot go up."); - return(1); - } - if(!Levitation && inv_weight() + 5 > 0) { - pline("Your load is too heavy to climb the stairs."); - return(1); - } - - goto_level(dlevel-1, TRUE); - return(1); -} - -goto_level(newlevel, at_stairs) -register int newlevel; -register boolean at_stairs; -{ - register fd; - register boolean up = (newlevel < dlevel); - - if(newlevel <= 0) done("escaped"); /* in fact < 0 is impossible */ - if(newlevel > MAXLEVEL) newlevel = MAXLEVEL; /* strange ... */ - if(newlevel == dlevel) return; /* this can happen */ - - glo(dlevel); - fd = creat(lock, FMASK); - if(fd < 0) { - /* - * This is not quite impossible: e.g., we may have - * exceeded our quota. If that is the case then we - * cannot leave this level, and cannot save either. - * Another possibility is that the directory was not - * writable. - */ - pline("A mysterious force prevents you from going %s.", - up ? "up" : "down"); - return; - } - - if(Punished) unplacebc(); - u.utrap = 0; /* needed in level_tele */ - u.ustuck = 0; /* idem */ - keepdogs(); - seeoff(1); - if(u.uswallow) /* idem */ - u.uswldtim = u.uswallow = 0; - flags.nscrinh = 1; - u.ux = FAR; /* hack */ - (void) inshop(); /* probably was a trapdoor */ - - savelev(fd,dlevel); - (void) close(fd); - - dlevel = newlevel; - if(maxdlevel < dlevel) - maxdlevel = dlevel; - glo(dlevel); - - if(!level_exists[dlevel]) - mklev(); - else { - extern int hackpid; - - if((fd = open(lock,0)) < 0) { - pline("Cannot open %s .", lock); - pline("Probably someone removed it."); - done("tricked"); - } - getlev(fd, hackpid, dlevel); - (void) close(fd); - } - - if(at_stairs) { - if(up) { - u.ux = xdnstair; - u.uy = ydnstair; - if(!u.ux) { /* entering a maze from below? */ - u.ux = xupstair; /* this will confuse the player! */ - u.uy = yupstair; - } - if(Punished && !Levitation){ - pline("With great effort you climb the stairs."); - placebc(1); - } - } else { - u.ux = xupstair; - u.uy = yupstair; - if(inv_weight() + 5 > 0 || Punished){ - pline("You fall down the stairs."); /* %% */ - losehp(rnd(3), "fall"); - if(Punished) { - if(uwep != uball && rn2(3)){ - pline("... and are hit by the iron ball."); - losehp(rnd(20), "iron ball"); - } - placebc(1); - } - selftouch("Falling, you"); - } - } - { register struct monst *mtmp = m_at(u.ux, u.uy); - if(mtmp) - mnexto(mtmp); - } - } else { /* trapdoor or level_tele */ - do { - u.ux = rnd(COLNO-1); - u.uy = rn2(ROWNO); - } while(levl[u.ux][u.uy].typ != ROOM || - m_at(u.ux,u.uy)); - if(Punished){ - if(uwep != uball && !up /* %% */ && rn2(5)){ - pline("The iron ball falls on your head."); - losehp(rnd(25), "iron ball"); - } - placebc(1); - } - selftouch("Falling, you"); - } - (void) inshop(); - initrack(); - - losedogs(); - { register struct monst *mtmp; - if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp); /* riv05!a3 */ - } - flags.nscrinh = 0; - setsee(); - seeobjs(); /* make old cadavers disappear - riv05!a3 */ - docrt(); - pickup(1); - read_engr_at(u.ux,u.uy); -} - -donull() { - return(1); /* Do nothing, but let other things happen */ -} - -dopray() { - nomovemsg = "You finished your prayer."; - nomul(-3); - return(1); -} - -struct monst *bhit(), *boomhit(); -dothrow() -{ - register struct obj *obj; - register struct monst *mon; - register tmp; - - obj = getobj("#)", "throw"); /* it is also possible to throw food */ - /* (or jewels, or iron balls ... ) */ - if(!obj || !getdir(1)) /* ask "in what direction?" */ - return(0); - if(obj->owornmask & (W_ARMOR | W_RING)){ - pline("You can't throw something you are wearing."); - return(0); - } - - u_wipe_engr(2); - - if(obj == uwep){ - if(obj->cursed){ - pline("Your weapon is welded to your hand."); - return(1); - } - if(obj->quan > 1) - setuwep(splitobj(obj, 1)); - else - setuwep((struct obj *) 0); - } - else if(obj->quan > 1) - (void) splitobj(obj, 1); - freeinv(obj); - if(u.uswallow) { - mon = u.ustuck; - bhitpos.x = mon->mx; - bhitpos.y = mon->my; - } else if(u.dz) { - if(u.dz < 0) { - pline("%s hits the ceiling, then falls back on top of your head.", - Doname(obj)); /* note: obj->quan == 1 */ - if(obj->olet == POTION_SYM) - potionhit(&youmonst, obj); - else { - if(uarmh) pline("Fortunately, you are wearing a helmet!"); - losehp(uarmh ? 1 : rnd((int)(obj->owt)), "falling object"); - dropy(obj); - } - } else { - pline("%s hits the floor.", Doname(obj)); - if(obj->otyp == EXPENSIVE_CAMERA) { - pline("It is shattered in a thousand pieces!"); - obfree(obj, Null(obj)); - } else if(obj->otyp == EGG) { - pline("\"Splash!\""); - obfree(obj, Null(obj)); - } else if(obj->olet == POTION_SYM) { - pline("The flask breaks, and you smell a peculiar odor ..."); - potionbreathe(obj); - obfree(obj, Null(obj)); - } else { - dropy(obj); - } - } - return(1); - } else if(obj->otyp == BOOMERANG) { - mon = boomhit(u.dx, u.dy); - if(mon == &youmonst) { /* the thing was caught */ - (void) addinv(obj); - return(1); - } - } else { - if(obj->otyp == PICK_AXE && shkcatch(obj)) - return(1); - - mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 : - (!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1, - obj->olet, - (int (*)()) 0, (int (*)()) 0, obj); - } - if(mon) { - /* awake monster if sleeping */ - wakeup(mon); - - if(obj->olet == WEAPON_SYM) { - tmp = -1+u.ulevel+mon->data->ac+abon(); - if(obj->otyp < ROCK) { - if(!uwep || - uwep->otyp != obj->otyp+(BOW-ARROW)) - tmp -= 4; - else { - tmp += uwep->spe; - } - } else - if(obj->otyp == BOOMERANG) tmp += 4; - tmp += obj->spe; - if(u.uswallow || tmp >= rnd(20)) { - if(hmon(mon,obj,1) == TRUE){ - /* mon still alive */ -#ifndef NOWORM - cutworm(mon,bhitpos.x,bhitpos.y,obj->otyp); -#endif NOWORM - } else mon = 0; - /* weapons thrown disappear sometimes */ - if(obj->otyp < BOOMERANG && rn2(3)) { - /* check bill; free */ - obfree(obj, (struct obj *) 0); - return(1); - } - } else miss(objects[obj->otyp].oc_name, mon); - } else if(obj->otyp == HEAVY_IRON_BALL) { - tmp = -1+u.ulevel+mon->data->ac+abon(); - if(!Punished || obj != uball) tmp += 2; - if(u.utrap) tmp -= 2; - if(u.uswallow || tmp >= rnd(20)) { - if(hmon(mon,obj,1) == FALSE) - mon = 0; /* he died */ - } else miss("iron ball", mon); - } else if(obj->olet == POTION_SYM && u.ulevel > rn2(15)) { - potionhit(mon, obj); - return(1); - } else { - if(cansee(bhitpos.x,bhitpos.y)) - pline("You miss %s.",monnam(mon)); - else pline("You miss it."); - if(obj->olet == FOOD_SYM && mon->data->mlet == 'd') - if(tamedog(mon,obj)) return(1); - if(obj->olet == GEM_SYM && mon->data->mlet == 'u' && - !mon->mtame){ - if(obj->dknown && objects[obj->otyp].oc_name_known){ - if(objects[obj->otyp].g_val > 0){ - u.uluck += 5; - goto valuable; - } else { - pline("%s is not interested in your junk.", - Monnam(mon)); - } - } else { /* value unknown to @ */ - u.uluck++; - valuable: - if(u.uluck > LUCKMAX) /* dan@ut-ngp */ - u.uluck = LUCKMAX; - pline("%s graciously accepts your gift.", - Monnam(mon)); - mpickobj(mon, obj); - rloc(mon); - return(1); - } - } - } - } - /* the code following might become part of dropy() */ - if(obj->otyp == CRYSKNIFE) - obj->otyp = WORM_TOOTH; - obj->ox = bhitpos.x; - obj->oy = bhitpos.y; - obj->nobj = fobj; - fobj = obj; - /* prevent him from throwing articles to the exit and escaping */ - /* subfrombill(obj); */ - stackobj(obj); - if(Punished && obj == uball && - (bhitpos.x != u.ux || bhitpos.y != u.uy)){ - freeobj(uchain); - unpobj(uchain); - if(u.utrap){ - if(u.utraptype == TT_PIT) - pline("The ball pulls you out of the pit!"); - else { - register long side = - rn2(3) ? LEFT_SIDE : RIGHT_SIDE; - pline("The ball pulls you out of the bear trap."); - pline("Your %s leg is severely damaged.", - (side == LEFT_SIDE) ? "left" : "right"); - set_wounded_legs(side, 500+rn2(1000)); - losehp(2, "thrown ball"); - } - u.utrap = 0; - } - unsee(); - uchain->nobj = fobj; - fobj = uchain; - u.ux = uchain->ox = bhitpos.x - u.dx; - u.uy = uchain->oy = bhitpos.y - u.dy; - setsee(); - (void) inshop(); - } - if(cansee(bhitpos.x, bhitpos.y)) prl(bhitpos.x,bhitpos.y); - return(1); -} - -/* split obj so that it gets size num */ -/* remainder is put in the object structure delivered by this call */ -struct obj * -splitobj(obj, num) register struct obj *obj; register int num; { -register struct obj *otmp; - otmp = newobj(0); - *otmp = *obj; /* copies whole structure */ - otmp->o_id = flags.ident++; - otmp->onamelth = 0; - obj->quan = num; - obj->owt = weight(obj); - otmp->quan -= num; - otmp->owt = weight(otmp); /* -= obj->owt ? */ - obj->nobj = otmp; - if(obj->unpaid) splitbill(obj,otmp); - return(otmp); -} - -more_experienced(exp,rexp) -register int exp, rexp; -{ - extern char pl_character[]; - - u.uexp += exp; - u.urexp += 4*exp + rexp; - if(exp) flags.botl = 1; - if(u.urexp >= ((pl_character[0] == 'W') ? 1000 : 2000)) - flags.beginner = 0; -} - -set_wounded_legs(side, timex) -register long side; -register int timex; -{ - if(!Wounded_legs || (Wounded_legs & TIMEOUT)) - Wounded_legs |= side + timex; - else - Wounded_legs |= side; -} - -heal_legs() -{ - if(Wounded_legs) { - if((Wounded_legs & BOTH_SIDES) == BOTH_SIDES) - pline("Your legs feel somewhat better."); - else - pline("Your leg feels somewhat better."); - Wounded_legs = 0; - } -} diff --git a/games/hack/hack.do_name.c b/games/hack/hack.do_name.c deleted file mode 100644 index 72ac62c86253..000000000000 --- a/games/hack/hack.do_name.c +++ /dev/null @@ -1,289 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.do_name.c - version 1.0.3 */ - -#include "hack.h" -#include -extern char plname[]; - -coord -getpos(force,goal) int force; char *goal; { -register cx,cy,i,c; -extern char sdir[]; /* defined in hack.c */ -extern schar xdir[], ydir[]; /* idem */ -extern char *visctrl(); /* see below */ -coord cc; - pline("(For instructions type a ?)"); - cx = u.ux; - cy = u.uy; - curs(cx,cy+2); - while((c = readchar()) != '.'){ - for(i=0; i<8; i++) if(sdir[i] == c){ - if(1 <= cx + xdir[i] && cx + xdir[i] <= COLNO) - cx += xdir[i]; - if(0 <= cy + ydir[i] && cy + ydir[i] <= ROWNO-1) - cy += ydir[i]; - goto nxtc; - } - if(c == '?'){ - pline("Use [hjkl] to move the cursor to %s.", goal); - pline("Type a . when you are at the right place."); - } else { - pline("Unknown direction: '%s' (%s).", - visctrl(c), - force ? "use hjkl or ." : "aborted"); - if(force) goto nxtc; - cc.x = -1; - cc.y = 0; - return(cc); - } - nxtc: ; - curs(cx,cy+2); - } - cc.x = cx; - cc.y = cy; - return(cc); -} - -do_mname(){ -char buf[BUFSZ]; -coord cc; -register int cx,cy,lth,i; -register struct monst *mtmp, *mtmp2; -extern char *lmonnam(); - cc = getpos(0, "the monster you want to name"); - cx = cc.x; - cy = cc.y; - if(cx < 0) return(0); - mtmp = m_at(cx,cy); - if(!mtmp){ - if(cx == u.ux && cy == u.uy) - pline("This ugly monster is called %s and cannot be renamed.", - plname); - else - pline("There is no monster there."); - return(1); - } - if(mtmp->mimic){ - pline("I see no monster there."); - return(1); - } - if(!cansee(cx,cy)) { - pline("I cannot see a monster there."); - return(1); - } - pline("What do you want to call %s? ", lmonnam(mtmp)); - getlin(buf); - clrlin(); - if(!*buf || *buf == '\033') - return(1); - lth = strlen(buf)+1; - if(lth > 63){ - buf[62] = 0; - lth = 63; - } - mtmp2 = newmonst(mtmp->mxlth + lth); - *mtmp2 = *mtmp; - for(i=0; imxlth; i++) - ((char *) mtmp2->mextra)[i] = ((char *) mtmp->mextra)[i]; - mtmp2->mnamelth = lth; - (void) strcpy(NAME(mtmp2), buf); - replmon(mtmp,mtmp2); - return(1); -} - -/* - * This routine changes the address of obj . Be careful not to call it - * when there might be pointers around in unknown places. For now: only - * when obj is in the inventory. - */ -do_oname(obj) register struct obj *obj; { -register struct obj *otmp, *otmp2; -register lth; -char buf[BUFSZ]; - pline("What do you want to name %s? ", doname(obj)); - getlin(buf); - clrlin(); - if(!*buf || *buf == '\033') - return; - lth = strlen(buf)+1; - if(lth > 63){ - buf[62] = 0; - lth = 63; - } - otmp2 = newobj(lth); - *otmp2 = *obj; - otmp2->onamelth = lth; - (void) strcpy(ONAME(otmp2), buf); - - setworn((struct obj *) 0, obj->owornmask); - setworn(otmp2, otmp2->owornmask); - - /* do freeinv(obj); etc. by hand in order to preserve - the position of this object in the inventory */ - if(obj == invent) invent = otmp2; - else for(otmp = invent; ; otmp = otmp->nobj){ - if(!otmp) - panic("Do_oname: cannot find obj."); - if(otmp->nobj == obj){ - otmp->nobj = otmp2; - break; - } - } - /* obfree(obj, otmp2); /* now unnecessary: no pointers on bill */ - free((char *) obj); /* let us hope nobody else saved a pointer */ -} - -ddocall() -{ - register struct obj *obj; - - pline("Do you want to name an individual object? [ny] "); - switch(readchar()) { - case '\033': - break; - case 'y': - obj = getobj("#", "name"); - if(obj) do_oname(obj); - break; - default: - obj = getobj("?!=/", "call"); - if(obj) docall(obj); - } - return(0); -} - -docall(obj) -register struct obj *obj; -{ - char buf[BUFSZ]; - struct obj otemp; - register char **str1; - extern char *xname(); - register char *str; - - otemp = *obj; - otemp.quan = 1; - otemp.onamelth = 0; - str = xname(&otemp); - pline("Call %s %s: ", index(vowels,*str) ? "an" : "a", str); - getlin(buf); - clrlin(); - if(!*buf || *buf == '\033') - return; - str = newstring(strlen(buf)+1); - (void) strcpy(str,buf); - str1 = &(objects[obj->otyp].oc_uname); - if(*str1) free(*str1); - *str1 = str; -} - -char *ghostnames[] = { /* these names should have length < PL_NSIZ */ - "adri", "andries", "andreas", "bert", "david", "dirk", "emile", - "frans", "fred", "greg", "hether", "jay", "john", "jon", "kay", - "kenny", "maud", "michiel", "mike", "peter", "robert", "ron", - "tom", "wilmar" -}; - -char * -xmonnam(mtmp, vb) register struct monst *mtmp; int vb; { -static char buf[BUFSZ]; /* %% */ -extern char *shkname(); - if(mtmp->mnamelth && !vb) { - (void) strcpy(buf, NAME(mtmp)); - return(buf); - } - switch(mtmp->data->mlet) { - case ' ': - { register char *gn = (char *) mtmp->mextra; - if(!*gn) { /* might also look in scorefile */ - gn = ghostnames[rn2(SIZE(ghostnames))]; - if(!rn2(2)) (void) - strcpy((char *) mtmp->mextra, !rn2(5) ? plname : gn); - } - (void) sprintf(buf, "%s's ghost", gn); - } - break; - case '@': - if(mtmp->isshk) { - (void) strcpy(buf, shkname(mtmp)); - break; - } - /* fall into next case */ - default: - (void) sprintf(buf, "the %s%s", - mtmp->minvis ? "invisible " : "", - mtmp->data->mname); - } - if(vb && mtmp->mnamelth) { - (void) strcat(buf, " called "); - (void) strcat(buf, NAME(mtmp)); - } - return(buf); -} - -char * -lmonnam(mtmp) register struct monst *mtmp; { - return(xmonnam(mtmp, 1)); -} - -char * -monnam(mtmp) register struct monst *mtmp; { - return(xmonnam(mtmp, 0)); -} - -char * -Monnam(mtmp) register struct monst *mtmp; { -register char *bp = monnam(mtmp); - if('a' <= *bp && *bp <= 'z') *bp += ('A' - 'a'); - return(bp); -} - -char * -amonnam(mtmp,adj) -register struct monst *mtmp; -register char *adj; -{ - register char *bp = monnam(mtmp); - static char buf[BUFSZ]; /* %% */ - - if(!strncmp(bp, "the ", 4)) bp += 4; - (void) sprintf(buf, "the %s %s", adj, bp); - return(buf); -} - -char * -Amonnam(mtmp, adj) -register struct monst *mtmp; -register char *adj; -{ - register char *bp = amonnam(mtmp,adj); - - *bp = 'T'; - return(bp); -} - -char * -Xmonnam(mtmp) register struct monst *mtmp; { -register char *bp = Monnam(mtmp); - if(!strncmp(bp, "The ", 4)) { - bp += 2; - *bp = 'A'; - } - return(bp); -} - -char * -visctrl(c) -char c; -{ -static char ccc[3]; - if(c < 040) { - ccc[0] = '^'; - ccc[1] = c + 0100; - ccc[2] = 0; - } else { - ccc[0] = c; - ccc[1] = 0; - } - return(ccc); -} diff --git a/games/hack/hack.do_wear.c b/games/hack/hack.do_wear.c deleted file mode 100644 index 423955d2940a..000000000000 --- a/games/hack/hack.do_wear.c +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.do_wear.c - version 1.0.3 */ - -#include "hack.h" -#include -extern char *nomovemsg; -extern char quitchars[]; -extern char *Doname(); - -off_msg(otmp) register struct obj *otmp; { - pline("You were wearing %s.", doname(otmp)); -} - -doremarm() { - register struct obj *otmp; - if(!uarm && !uarmh && !uarms && !uarmg) { - pline("Not wearing any armor."); - return(0); - } - otmp = (!uarmh && !uarms && !uarmg) ? uarm : - (!uarms && !uarm && !uarmg) ? uarmh : - (!uarmh && !uarm && !uarmg) ? uarms : - (!uarmh && !uarm && !uarms) ? uarmg : - getobj("[", "take off"); - if(!otmp) return(0); - if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) { - pline("You can't take that off."); - return(0); - } - if( otmp == uarmg && uwep && uwep->cursed ) { /* myers@uwmacc */ - pline("You seem not able to take off the gloves while holding your weapon."); - return(0); - } - (void) armoroff(otmp); - return(1); -} - -doremring() { - if(!uleft && !uright){ - pline("Not wearing any ring."); - return(0); - } - if(!uleft) - return(dorr(uright)); - if(!uright) - return(dorr(uleft)); - if(uleft && uright) while(1) { - char answer; - - pline("What ring, Right or Left? [ rl?]"); - if(index(quitchars, (answer = readchar()))) - return(0); - switch(answer) { - case 'l': - case 'L': - return(dorr(uleft)); - case 'r': - case 'R': - return(dorr(uright)); - case '?': - (void) doprring(); - /* might look at morc here %% */ - } - } - /* NOTREACHED */ -#ifdef lint - return(0); -#endif lint -} - -dorr(otmp) register struct obj *otmp; { - if(cursed(otmp)) return(0); - ringoff(otmp); - off_msg(otmp); - return(1); -} - -cursed(otmp) register struct obj *otmp; { - if(otmp->cursed){ - pline("You can't. It appears to be cursed."); - return(1); - } - return(0); -} - -armoroff(otmp) register struct obj *otmp; { -register int delay = -objects[otmp->otyp].oc_delay; - if(cursed(otmp)) return(0); - setworn((struct obj *) 0, otmp->owornmask & W_ARMOR); - if(delay) { - nomul(delay); - switch(otmp->otyp) { - case HELMET: - nomovemsg = "You finished taking off your helmet."; - break; - case PAIR_OF_GLOVES: - nomovemsg = "You finished taking off your gloves"; - break; - default: - nomovemsg = "You finished taking off your suit."; - } - } else { - off_msg(otmp); - } - return(1); -} - -doweararm() { - register struct obj *otmp; - register int delay; - register int err = 0; - long mask = 0; - - otmp = getobj("[", "wear"); - if(!otmp) return(0); - if(otmp->owornmask & W_ARMOR) { - pline("You are already wearing that!"); - return(0); - } - if(otmp->otyp == HELMET){ - if(uarmh) { - pline("You are already wearing a helmet."); - err++; - } else - mask = W_ARMH; - } else if(otmp->otyp == SHIELD){ - if(uarms) pline("You are already wearing a shield."), err++; - if(uwep && uwep->otyp == TWO_HANDED_SWORD) - pline("You cannot wear a shield and wield a two-handed sword."), err++; - if(!err) mask = W_ARMS; - } else if(otmp->otyp == PAIR_OF_GLOVES) { - if(uarmg) { - pline("You are already wearing gloves."); - err++; - } else - if(uwep && uwep->cursed) { - pline("You cannot wear gloves over your weapon."); - err++; - } else - mask = W_ARMG; - } else { - if(uarm) { - if(otmp->otyp != ELVEN_CLOAK || uarm2) { - pline("You are already wearing some armor."); - err++; - } - } - if(!err) mask = W_ARM; - } - if(otmp == uwep && uwep->cursed) { - if(!err++) - pline("%s is welded to your hand.", Doname(uwep)); - } - if(err) return(0); - setworn(otmp, mask); - if(otmp == uwep) - setuwep((struct obj *) 0); - delay = -objects[otmp->otyp].oc_delay; - if(delay){ - nomul(delay); - nomovemsg = "You finished your dressing manoeuvre."; - } - otmp->known = 1; - return(1); -} - -dowearring() { - register struct obj *otmp; - long mask = 0; - long oldprop; - - if(uleft && uright){ - pline("There are no more ring-fingers to fill."); - return(0); - } - otmp = getobj("=", "wear"); - if(!otmp) return(0); - if(otmp->owornmask & W_RING) { - pline("You are already wearing that!"); - return(0); - } - if(otmp == uleft || otmp == uright) { - pline("You are already wearing that."); - return(0); - } - if(otmp == uwep && uwep->cursed) { - pline("%s is welded to your hand.", Doname(uwep)); - return(0); - } - if(uleft) mask = RIGHT_RING; - else if(uright) mask = LEFT_RING; - else do { - char answer; - - pline("What ring-finger, Right or Left? "); - if(index(quitchars, (answer = readchar()))) - return(0); - switch(answer){ - case 'l': - case 'L': - mask = LEFT_RING; - break; - case 'r': - case 'R': - mask = RIGHT_RING; - break; - } - } while(!mask); - setworn(otmp, mask); - if(otmp == uwep) - setuwep((struct obj *) 0); - oldprop = u.uprops[PROP(otmp->otyp)].p_flgs; - u.uprops[PROP(otmp->otyp)].p_flgs |= mask; - switch(otmp->otyp){ - case RIN_LEVITATION: - if(!oldprop) float_up(); - break; - case RIN_PROTECTION_FROM_SHAPE_CHANGERS: - rescham(); - break; - case RIN_GAIN_STRENGTH: - u.ustr += otmp->spe; - u.ustrmax += otmp->spe; - if(u.ustr > 118) u.ustr = 118; - if(u.ustrmax > 118) u.ustrmax = 118; - flags.botl = 1; - break; - case RIN_INCREASE_DAMAGE: - u.udaminc += otmp->spe; - break; - } - prinv(otmp); - return(1); -} - -ringoff(obj) -register struct obj *obj; -{ -register long mask; - mask = obj->owornmask & W_RING; - setworn((struct obj *) 0, obj->owornmask); - if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask)) - impossible("Strange... I didnt know you had that ring."); - u.uprops[PROP(obj->otyp)].p_flgs &= ~mask; - switch(obj->otyp) { - case RIN_FIRE_RESISTANCE: - /* Bad luck if the player is in hell... --jgm */ - if (!Fire_resistance && dlevel >= 30) { - pline("The flames of Hell burn you to a crisp."); - killer = "stupidity in hell"; - done("burned"); - } - break; - case RIN_LEVITATION: - if(!Levitation) { /* no longer floating */ - float_down(); - } - break; - case RIN_GAIN_STRENGTH: - u.ustr -= obj->spe; - u.ustrmax -= obj->spe; - if(u.ustr > 118) u.ustr = 118; - if(u.ustrmax > 118) u.ustrmax = 118; - flags.botl = 1; - break; - case RIN_INCREASE_DAMAGE: - u.udaminc -= obj->spe; - break; - } -} - -find_ac(){ -register int uac = 10; - if(uarm) uac -= ARM_BONUS(uarm); - if(uarm2) uac -= ARM_BONUS(uarm2); - if(uarmh) uac -= ARM_BONUS(uarmh); - if(uarms) uac -= ARM_BONUS(uarms); - if(uarmg) uac -= ARM_BONUS(uarmg); - if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe; - if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe; - if(uac != u.uac){ - u.uac = uac; - flags.botl = 1; - } -} - -glibr(){ -register struct obj *otmp; -int xfl = 0; - if(!uarmg) if(uleft || uright) { - /* Note: at present also cursed rings fall off */ - pline("Your %s off your fingers.", - (uleft && uright) ? "rings slip" : "ring slips"); - xfl++; - if((otmp = uleft) != Null(obj)){ - ringoff(uleft); - dropx(otmp); - } - if((otmp = uright) != Null(obj)){ - ringoff(uright); - dropx(otmp); - } - } - if((otmp = uwep) != Null(obj)){ - /* Note: at present also cursed weapons fall */ - setuwep((struct obj *) 0); - dropx(otmp); - pline("Your weapon %sslips from your hands.", - xfl ? "also " : ""); - } -} - -struct obj * -some_armor(){ -register struct obj *otmph = uarm; - if(uarmh && (!otmph || !rn2(4))) otmph = uarmh; - if(uarmg && (!otmph || !rn2(4))) otmph = uarmg; - if(uarms && (!otmph || !rn2(4))) otmph = uarms; - return(otmph); -} - -corrode_armor(){ -register struct obj *otmph = some_armor(); - if(otmph){ - if(otmph->rustfree || - otmph->otyp == ELVEN_CLOAK || - otmph->otyp == LEATHER_ARMOR || - otmph->otyp == STUDDED_LEATHER_ARMOR) { - pline("Your %s not affected!", - aobjnam(otmph, "are")); - return; - } - pline("Your %s!", aobjnam(otmph, "corrode")); - otmph->spe--; - } -} diff --git a/games/hack/hack.dog.c b/games/hack/hack.dog.c deleted file mode 100644 index aa4387abbee9..000000000000 --- a/games/hack/hack.dog.c +++ /dev/null @@ -1,413 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.dog.c - version 1.0.3 */ - -#include "hack.h" -#include "hack.mfndpos.h" -extern struct monst *makemon(); -#include "def.edog.h" -#include "def.mkroom.h" - -struct permonst li_dog = - { "little dog", 'd',2,18,6,1,6,sizeof(struct edog) }; -struct permonst dog = - { "dog", 'd',4,16,5,1,6,sizeof(struct edog) }; -struct permonst la_dog = - { "large dog", 'd',6,15,4,2,4,sizeof(struct edog) }; - - -makedog(){ -register struct monst *mtmp = makemon(&li_dog,u.ux,u.uy); - if(!mtmp) return; /* dogs were genocided */ - initedog(mtmp); -} - -initedog(mtmp) register struct monst *mtmp; { - mtmp->mtame = mtmp->mpeaceful = 1; - EDOG(mtmp)->hungrytime = 1000 + moves; - EDOG(mtmp)->eattime = 0; - EDOG(mtmp)->droptime = 0; - EDOG(mtmp)->dropdist = 10000; - EDOG(mtmp)->apport = 10; - EDOG(mtmp)->whistletime = 0; -} - -/* attach the monsters that went down (or up) together with @ */ -struct monst *mydogs = 0; -struct monst *fallen_down = 0; /* monsters that fell through a trapdoor */ - /* they will appear on the next level @ goes to, even if he goes up! */ - -losedogs(){ -register struct monst *mtmp; - while(mtmp = mydogs){ - mydogs = mtmp->nmon; - mtmp->nmon = fmon; - fmon = mtmp; - mnexto(mtmp); - } - while(mtmp = fallen_down){ - fallen_down = mtmp->nmon; - mtmp->nmon = fmon; - fmon = mtmp; - rloc(mtmp); - } -} - -keepdogs(){ -register struct monst *mtmp; - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) - if(dist(mtmp->mx,mtmp->my) < 3 && follower(mtmp) - && !mtmp->msleep && !mtmp->mfroz) { - relmon(mtmp); - mtmp->nmon = mydogs; - mydogs = mtmp; - unpmon(mtmp); - keepdogs(); /* we destroyed the link, so use recursion */ - return; /* (admittedly somewhat primitive) */ - } -} - -fall_down(mtmp) register struct monst *mtmp; { - relmon(mtmp); - mtmp->nmon = fallen_down; - fallen_down = mtmp; - unpmon(mtmp); - mtmp->mtame = 0; -} - -/* return quality of food; the lower the better */ -#define DOGFOOD 0 -#define CADAVER 1 -#define ACCFOOD 2 -#define MANFOOD 3 -#define APPORT 4 -#define POISON 5 -#define UNDEF 6 -dogfood(obj) register struct obj *obj; { - switch(obj->olet) { - case FOOD_SYM: - return( - (obj->otyp == TRIPE_RATION) ? DOGFOOD : - (obj->otyp < CARROT) ? ACCFOOD : - (obj->otyp < CORPSE) ? MANFOOD : - (poisonous(obj) || obj->age + 50 <= moves || - obj->otyp == DEAD_COCKATRICE) - ? POISON : CADAVER - ); - default: - if(!obj->cursed) return(APPORT); - /* fall into next case */ - case BALL_SYM: - case CHAIN_SYM: - case ROCK_SYM: - return(UNDEF); - } -} - -/* return 0 (no move), 1 (move) or 2 (dead) */ -dog_move(mtmp, after) register struct monst *mtmp; { -register int nx,ny,omx,omy,appr,nearer,j; -int udist,chi,i,whappr; -register struct monst *mtmp2; -register struct permonst *mdat = mtmp->data; -register struct edog *edog = EDOG(mtmp); -struct obj *obj; -struct trap *trap; -xchar cnt,chcnt,nix,niy; -schar dogroom,uroom; -xchar gx,gy,gtyp,otyp; /* current goal */ -coord poss[9]; -int info[9]; -#define GDIST(x,y) ((x-gx)*(x-gx) + (y-gy)*(y-gy)) -#define DDIST(x,y) ((x-omx)*(x-omx) + (y-omy)*(y-omy)) - - if(moves <= edog->eattime) return(0); /* dog is still eating */ - omx = mtmp->mx; - omy = mtmp->my; - whappr = (moves - EDOG(mtmp)->whistletime < 5); - if(moves > edog->hungrytime + 500 && !mtmp->mconf){ - mtmp->mconf = 1; - mtmp->mhpmax /= 3; - if(mtmp->mhp > mtmp->mhpmax) - mtmp->mhp = mtmp->mhpmax; - if(cansee(omx,omy)) - pline("%s is confused from hunger.", Monnam(mtmp)); - else pline("You feel worried about %s.", monnam(mtmp)); - } else - if(moves > edog->hungrytime + 750 || mtmp->mhp < 1){ - if(cansee(omx,omy)) - pline("%s dies from hunger.", Monnam(mtmp)); - else - pline("You have a sad feeling for a moment, then it passes."); - mondied(mtmp); - return(2); - } - dogroom = inroom(omx,omy); - uroom = inroom(u.ux,u.uy); - udist = dist(omx,omy); - - /* maybe we tamed him while being swallowed --jgm */ - if(!udist) return(0); - - /* if we are carrying sth then we drop it (perhaps near @) */ - /* Note: if apport == 1 then our behaviour is independent of udist */ - if(mtmp->minvent){ - if(!rn2(udist) || !rn2((int) edog->apport)) - if(rn2(10) < edog->apport){ - relobj(mtmp, (int) mtmp->minvis); - if(edog->apport > 1) edog->apport--; - edog->dropdist = udist; /* hpscdi!jon */ - edog->droptime = moves; - } - } else { - if(obj = o_at(omx,omy)) if(!index("0_", obj->olet)){ - if((otyp = dogfood(obj)) <= CADAVER){ - nix = omx; - niy = omy; - goto eatobj; - } - if(obj->owt < 10*mtmp->data->mlevel) - if(rn2(20) < edog->apport+3) - if(rn2(udist) || !rn2((int) edog->apport)){ - freeobj(obj); - unpobj(obj); - /* if(levl[omx][omy].scrsym == obj->olet) - newsym(omx,omy); */ - mpickobj(mtmp,obj); - } - } - } - - /* first we look for food */ - gtyp = UNDEF; /* no goal as yet */ -#ifdef LINT - gx = gy = 0; /* suppress 'used before set' message */ -#endif LINT - for(obj = fobj; obj; obj = obj->nobj) { - otyp = dogfood(obj); - if(otyp > gtyp || otyp == UNDEF) continue; - if(inroom(obj->ox,obj->oy) != dogroom) continue; - if(otyp < MANFOOD && - (dogroom >= 0 || DDIST(obj->ox,obj->oy) < 10)) { - if(otyp < gtyp || (otyp == gtyp && - DDIST(obj->ox,obj->oy) < DDIST(gx,gy))){ - gx = obj->ox; - gy = obj->oy; - gtyp = otyp; - } - } else - if(gtyp == UNDEF && dogroom >= 0 && - uroom == dogroom && - !mtmp->minvent && edog->apport > rn2(8)){ - gx = obj->ox; - gy = obj->oy; - gtyp = APPORT; - } - } - if(gtyp == UNDEF || - (gtyp != DOGFOOD && gtyp != APPORT && moves < edog->hungrytime)){ - if(dogroom < 0 || dogroom == uroom){ - gx = u.ux; - gy = u.uy; -#ifndef QUEST - } else { - int tmp = rooms[dogroom].fdoor; - cnt = rooms[dogroom].doorct; - - gx = gy = FAR; /* random, far away */ - while(cnt--){ - if(dist(gx,gy) > - dist(doors[tmp].x, doors[tmp].y)){ - gx = doors[tmp].x; - gy = doors[tmp].y; - } - tmp++; - } - /* here gx == FAR e.g. when dog is in a vault */ - if(gx == FAR || (gx == omx && gy == omy)){ - gx = u.ux; - gy = u.uy; - } -#endif QUEST - } - appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0; - if(after && udist <= 4 && gx == u.ux && gy == u.uy) - return(0); - if(udist > 1){ - if(!IS_ROOM(levl[u.ux][u.uy].typ) || !rn2(4) || - whappr || - (mtmp->minvent && rn2((int) edog->apport))) - appr = 1; - } - /* if you have dog food he'll follow you more closely */ - if(appr == 0){ - obj = invent; - while(obj){ - if(obj->otyp == TRIPE_RATION){ - appr = 1; - break; - } - obj = obj->nobj; - } - } - } else appr = 1; /* gtyp != UNDEF */ - if(mtmp->mconf) appr = 0; - - if(gx == u.ux && gy == u.uy && (dogroom != uroom || dogroom < 0)){ - extern coord *gettrack(); - register coord *cp; - cp = gettrack(omx,omy); - if(cp){ - gx = cp->x; - gy = cp->y; - } - } - - nix = omx; - niy = omy; - cnt = mfndpos(mtmp,poss,info,ALLOW_M | ALLOW_TRAPS); - chcnt = 0; - chi = -1; - for(i=0; idata->mlevel >= mdat->mlevel+2 || - mtmp2->data->mlet == 'c') - continue; - if(after) return(0); /* hit only once each move */ - - if(hitmm(mtmp, mtmp2) == 1 && rn2(4) && - mtmp2->mlstmv != moves && - hitmm(mtmp2,mtmp) == 2) return(2); - return(0); - } - - /* dog avoids traps */ - /* but perhaps we have to pass a trap in order to follow @ */ - if((info[i] & ALLOW_TRAPS) && (trap = t_at(nx,ny))){ - if(!trap->tseen && rn2(40)) continue; - if(rn2(10)) continue; - } - - /* dog eschewes cursed objects */ - /* but likes dog food */ - obj = fobj; - while(obj){ - if(obj->ox != nx || obj->oy != ny) - goto nextobj; - if(obj->cursed) goto nxti; - if(obj->olet == FOOD_SYM && - (otyp = dogfood(obj)) < MANFOOD && - (otyp < ACCFOOD || edog->hungrytime <= moves)){ - /* Note: our dog likes the food so much that he - might eat it even when it conceals a cursed object */ - nix = nx; - niy = ny; - chi = i; - eatobj: - edog->eattime = - moves + obj->quan * objects[obj->otyp].oc_delay; - if(edog->hungrytime < moves) - edog->hungrytime = moves; - edog->hungrytime += - 5*obj->quan * objects[obj->otyp].nutrition; - mtmp->mconf = 0; - if(cansee(nix,niy)) - pline("%s ate %s.", Monnam(mtmp), doname(obj)); - /* perhaps this was a reward */ - if(otyp != CADAVER) - edog->apport += 200/(edog->dropdist+moves-edog->droptime); - delobj(obj); - goto newdogpos; - } - nextobj: - obj = obj->nobj; - } - - for(j=0; jmtrack[j].x && ny == mtmp->mtrack[j].y) - if(rn2(4*(cnt-j))) goto nxti; - -/* Some stupid C compilers cannot compute the whole expression at once. */ - nearer = GDIST(nx,ny); - nearer -= GDIST(nix,niy); - nearer *= appr; - if((nearer == 0 && !rn2(++chcnt)) || nearer<0 || - (nearer > 0 && !whappr && - ((omx == nix && omy == niy && !rn2(3)) - || !rn2(12)) - )){ - nix = nx; - niy = ny; - if(nearer < 0) chcnt = 0; - chi = i; - } - nxti: ; - } -newdogpos: - if(nix != omx || niy != omy){ - if(info[chi] & ALLOW_U){ - (void) hitu(mtmp, d(mdat->damn, mdat->damd)+1); - return(0); - } - mtmp->mx = nix; - mtmp->my = niy; - for(j=MTSZ-1; j>0; j--) mtmp->mtrack[j] = mtmp->mtrack[j-1]; - mtmp->mtrack[0].x = omx; - mtmp->mtrack[0].y = omy; - } - if(mintrap(mtmp) == 2) /* he died */ - return(2); - pmon(mtmp); - return(1); -} - -/* return roomnumber or -1 */ -inroom(x,y) xchar x,y; { -#ifndef QUEST - register struct mkroom *croom = &rooms[0]; - while(croom->hx >= 0){ - if(croom->hx >= x-1 && croom->lx <= x+1 && - croom->hy >= y-1 && croom->ly <= y+1) - return(croom - rooms); - croom++; - } -#endif QUEST - return(-1); /* not in room or on door */ -} - -tamedog(mtmp, obj) -register struct monst *mtmp; -register struct obj *obj; -{ - register struct monst *mtmp2; - - if(flags.moonphase == FULL_MOON && night() && rn2(6)) - return(0); - - /* If we cannot tame him, at least he's no longer afraid. */ - mtmp->mflee = 0; - mtmp->mfleetim = 0; - if(mtmp->mtame || mtmp->mfroz || -#ifndef NOWORM - mtmp->wormno || -#endif NOWORM - mtmp->isshk || mtmp->isgd || index(" &@12", mtmp->data->mlet)) - return(0); /* no tame long worms? */ - if(obj) { - if(dogfood(obj) >= MANFOOD) return(0); - if(cansee(mtmp->mx,mtmp->my)){ - pline("%s devours the %s.", Monnam(mtmp), - objects[obj->otyp].oc_name); - } - obfree(obj, (struct obj *) 0); - } - mtmp2 = newmonst(sizeof(struct edog) + mtmp->mnamelth); - *mtmp2 = *mtmp; - mtmp2->mxlth = sizeof(struct edog); - if(mtmp->mnamelth) (void) strcpy(NAME(mtmp2), NAME(mtmp)); - initedog(mtmp2); - replmon(mtmp,mtmp2); - return(1); -} diff --git a/games/hack/hack.eat.c b/games/hack/hack.eat.c deleted file mode 100644 index f1a767779af1..000000000000 --- a/games/hack/hack.eat.c +++ /dev/null @@ -1,459 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.eat.c - version 1.0.3 */ - -#include "hack.h" -char POISONOUS[] = "ADKSVabhks"; -extern char *nomovemsg; -extern int (*afternmv)(); -extern int (*occupation)(); -extern char *occtxt; -extern struct obj *splitobj(), *addinv(); - -/* hunger texts used on bottom line (each 8 chars long) */ -#define SATIATED 0 -#define NOT_HUNGRY 1 -#define HUNGRY 2 -#define WEAK 3 -#define FAINTING 4 -#define FAINTED 5 -#define STARVED 6 - -char *hu_stat[] = { - "Satiated", - " ", - "Hungry ", - "Weak ", - "Fainting", - "Fainted ", - "Starved " -}; - -init_uhunger(){ - u.uhunger = 900; - u.uhs = NOT_HUNGRY; -} - -#define TTSZ SIZE(tintxts) -struct { char *txt; int nut; } tintxts[] = { - "It contains first quality peaches - what a surprise!", 40, - "It contains salmon - not bad!", 60, - "It contains apple juice - perhaps not what you hoped for.", 20, - "It contains some nondescript substance, tasting awfully.", 500, - "It contains rotten meat. You vomit.", -50, - "It turns out to be empty.", 0 -}; - -static struct { - struct obj *tin; - int usedtime, reqtime; -} tin; - -opentin(){ - register int r; - - if(!carried(tin.tin)) /* perhaps it was stolen? */ - return(0); /* %% probably we should use tinoid */ - if(tin.usedtime++ >= 50) { - pline("You give up your attempt to open the tin."); - return(0); - } - if(tin.usedtime < tin.reqtime) - return(1); /* still busy */ - - pline("You succeed in opening the tin."); - useup(tin.tin); - r = rn2(2*TTSZ); - if(r < TTSZ){ - pline(tintxts[r].txt); - lesshungry(tintxts[r].nut); - if(r == 1) /* SALMON */ { - Glib = rnd(15); - pline("Eating salmon made your fingers very slippery."); - } - } else { - pline("It contains spinach - this makes you feel like Popeye!"); - lesshungry(600); - if(u.ustr < 118) - u.ustr += rnd( ((u.ustr < 17) ? 19 : 118) - u.ustr); - if(u.ustr > u.ustrmax) u.ustrmax = u.ustr; - flags.botl = 1; - } - return(0); -} - -Meatdone(){ - u.usym = '@'; - prme(); -} - -doeat(){ - register struct obj *otmp; - register struct objclass *ftmp; - register tmp; - - /* Is there some food (probably a heavy corpse) here on the ground? */ - if(!Levitation) - for(otmp = fobj; otmp; otmp = otmp->nobj) { - if(otmp->ox == u.ux && otmp->oy == u.uy && - otmp->olet == FOOD_SYM) { - pline("There %s %s here; eat %s? [ny] ", - (otmp->quan == 1) ? "is" : "are", - doname(otmp), - (otmp->quan == 1) ? "it" : "one"); - if(readchar() == 'y') { - if(otmp->quan != 1) - (void) splitobj(otmp, 1); - freeobj(otmp); - otmp = addinv(otmp); - addtobill(otmp); - goto gotit; - } - } - } - otmp = getobj("%", "eat"); - if(!otmp) return(0); -gotit: - if(otmp->otyp == TIN){ - if(uwep) { - switch(uwep->otyp) { - case CAN_OPENER: - tmp = 1; - break; - case DAGGER: - case CRYSKNIFE: - tmp = 3; - break; - case PICK_AXE: - case AXE: - tmp = 6; - break; - default: - goto no_opener; - } - pline("Using your %s you try to open the tin.", - aobjnam(uwep, (char *) 0)); - } else { - no_opener: - pline("It is not so easy to open this tin."); - if(Glib) { - pline("The tin slips out of your hands."); - if(otmp->quan > 1) { - register struct obj *obj; - extern struct obj *splitobj(); - - obj = splitobj(otmp, 1); - if(otmp == uwep) setuwep(obj); - } - dropx(otmp); - return(1); - } - tmp = 10 + rn2(1 + 500/((int)(u.ulevel + u.ustr))); - } - tin.reqtime = tmp; - tin.usedtime = 0; - tin.tin = otmp; - occupation = opentin; - occtxt = "opening the tin"; - return(1); - } - ftmp = &objects[otmp->otyp]; - multi = -ftmp->oc_delay; - if(otmp->otyp >= CORPSE && eatcorpse(otmp)) goto eatx; - if(!rn2(7) && otmp->otyp != FORTUNE_COOKIE) { - pline("Blecch! Rotten food!"); - if(!rn2(4)) { - pline("You feel rather light headed."); - Confusion += d(2,4); - } else if(!rn2(4)&& !Blind) { - pline("Everything suddenly goes dark."); - Blind = d(2,10); - seeoff(0); - } else if(!rn2(3)) { - if(Blind) - pline("The world spins and you slap against the floor."); - else - pline("The world spins and goes dark."); - nomul(-rnd(10)); - nomovemsg = "You are conscious again."; - } - lesshungry(ftmp->nutrition / 4); - } else { - if(u.uhunger >= 1500) { - pline("You choke over your food."); - pline("You die..."); - killer = ftmp->oc_name; - done("choked"); - } - switch(otmp->otyp){ - case FOOD_RATION: - if(u.uhunger <= 200) - pline("That food really hit the spot!"); - else if(u.uhunger <= 700) - pline("That satiated your stomach!"); - else { - pline("You're having a hard time getting all that food down."); - multi -= 2; - } - lesshungry(ftmp->nutrition); - if(multi < 0) nomovemsg = "You finished your meal."; - break; - case TRIPE_RATION: - pline("Yak - dog food!"); - more_experienced(1,0); - flags.botl = 1; - if(rn2(2)){ - pline("You vomit."); - morehungry(20); - if(Sick) { - Sick = 0; /* David Neves */ - pline("What a relief!"); - } - } else lesshungry(ftmp->nutrition); - break; - default: - if(otmp->otyp >= CORPSE) - pline("That %s tasted terrible!",ftmp->oc_name); - else - pline("That %s was delicious!",ftmp->oc_name); - lesshungry(ftmp->nutrition); - if(otmp->otyp == DEAD_LIZARD && (Confusion > 2)) - Confusion = 2; - else -#ifdef QUEST - if(otmp->otyp == CARROT && !Blind){ - u.uhorizon++; - setsee(); - pline("Your vision improves."); - } else -#endif QUEST - if(otmp->otyp == FORTUNE_COOKIE) { - if(Blind) { - pline("This cookie has a scrap of paper inside!"); - pline("What a pity, that you cannot read it!"); - } else - outrumor(); - } else - if(otmp->otyp == LUMP_OF_ROYAL_JELLY) { - /* This stuff seems to be VERY healthy! */ - if(u.ustrmax < 118) u.ustrmax++; - if(u.ustr < u.ustrmax) u.ustr++; - u.uhp += rnd(20); - if(u.uhp > u.uhpmax) { - if(!rn2(17)) u.uhpmax++; - u.uhp = u.uhpmax; - } - heal_legs(); - } - break; - } - } -eatx: - if(multi<0 && !nomovemsg){ - static char msgbuf[BUFSZ]; - (void) sprintf(msgbuf, "You finished eating the %s.", - ftmp->oc_name); - nomovemsg = msgbuf; - } - useup(otmp); - return(1); -} - -/* called in hack.main.c */ -gethungry(){ - --u.uhunger; - if(moves % 2) { - if(Regeneration) u.uhunger--; - if(Hunger) u.uhunger--; - /* a3: if(Hunger & LEFT_RING) u.uhunger--; - if(Hunger & RIGHT_RING) u.uhunger--; - etc. */ - } - if(moves % 20 == 0) { /* jimt@asgb */ - if(uleft) u.uhunger--; - if(uright) u.uhunger--; - } - newuhs(TRUE); -} - -/* called after vomiting and after performing feats of magic */ -morehungry(num) register num; { - u.uhunger -= num; - newuhs(TRUE); -} - -/* called after eating something (and after drinking fruit juice) */ -lesshungry(num) register num; { - u.uhunger += num; - newuhs(FALSE); -} - -unfaint(){ - u.uhs = FAINTING; - flags.botl = 1; -} - -newuhs(incr) boolean incr; { - register int newhs, h = u.uhunger; - - newhs = (h > 1000) ? SATIATED : - (h > 150) ? NOT_HUNGRY : - (h > 50) ? HUNGRY : - (h > 0) ? WEAK : FAINTING; - - if(newhs == FAINTING) { - if(u.uhs == FAINTED) - newhs = FAINTED; - if(u.uhs <= WEAK || rn2(20-u.uhunger/10) >= 19) { - if(u.uhs != FAINTED && multi >= 0 /* %% */) { - pline("You faint from lack of food."); - nomul(-10+(u.uhunger/10)); - nomovemsg = "You regain consciousness."; - afternmv = unfaint; - newhs = FAINTED; - } - } else - if(u.uhunger < -(int)(200 + 25*u.ulevel)) { - u.uhs = STARVED; - flags.botl = 1; - bot(); - pline("You die from starvation."); - done("starved"); - } - } - - if(newhs != u.uhs) { - if(newhs >= WEAK && u.uhs < WEAK) - losestr(1); /* this may kill you -- see below */ - else - if(newhs < WEAK && u.uhs >= WEAK && u.ustr < u.ustrmax) - losestr(-1); - switch(newhs){ - case HUNGRY: - pline((!incr) ? "You only feel hungry now." : - (u.uhunger < 145) ? "You feel hungry." : - "You are beginning to feel hungry."); - break; - case WEAK: - pline((!incr) ? "You feel weak now." : - (u.uhunger < 45) ? "You feel weak." : - "You are beginning to feel weak."); - break; - } - u.uhs = newhs; - flags.botl = 1; - if(u.uhp < 1) { - pline("You die from hunger and exhaustion."); - killer = "exhaustion"; - done("starved"); - } - } -} - -#define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ - ? 'a' + (otyp - DEAD_ACID_BLOB)\ - : '@' + (otyp - DEAD_HUMAN)) -poisonous(otmp) -register struct obj *otmp; -{ - return(index(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0); -} - -/* returns 1 if some text was printed */ -eatcorpse(otmp) register struct obj *otmp; { -register char let = CORPSE_I_TO_C(otmp->otyp); -register tp = 0; - if(let != 'a' && moves > otmp->age + 50 + rn2(100)) { - tp++; - pline("Ulch -- that meat was tainted!"); - pline("You get very sick."); - Sick = 10 + rn2(10); - u.usick_cause = objects[otmp->otyp].oc_name; - } else if(index(POISONOUS, let) && rn2(5)){ - tp++; - pline("Ecch -- that must have been poisonous!"); - if(!Poison_resistance){ - losestr(rnd(4)); - losehp(rnd(15), "poisonous corpse"); - } else - pline("You don't seem affected by the poison."); - } else if(index("ELNOPQRUuxz", let) && rn2(5)){ - tp++; - pline("You feel sick."); - losehp(rnd(8), "cadaver"); - } - switch(let) { - case 'L': - case 'N': - case 't': - Teleportation |= INTRINSIC; - break; - case 'W': - pluslvl(); - break; - case 'n': - u.uhp = u.uhpmax; - flags.botl = 1; - /* fall into next case */ - case '@': - pline("You cannibal! You will be sorry for this!"); - /* not tp++; */ - /* fall into next case */ - case 'd': - Aggravate_monster |= INTRINSIC; - break; - case 'I': - if(!Invis) { - Invis = 50+rn2(100); - if(!See_invisible) - newsym(u.ux, u.uy); - } else { - Invis |= INTRINSIC; - See_invisible |= INTRINSIC; - } - /* fall into next case */ - case 'y': -#ifdef QUEST - u.uhorizon++; -#endif QUEST - /* fall into next case */ - case 'B': - Confusion = 50; - break; - case 'D': - Fire_resistance |= INTRINSIC; - break; - case 'E': - Telepat |= INTRINSIC; - break; - case 'F': - case 'Y': - Cold_resistance |= INTRINSIC; - break; - case 'k': - case 's': - Poison_resistance |= INTRINSIC; - break; - case 'c': - pline("You turn to stone."); - killer = "dead cockatrice"; - done("died"); - /* NOTREACHED */ - case 'a': - if(Stoned) { - pline("What a pity - you just destroyed a future piece of art!"); - tp++; - Stoned = 0; - } - break; - case 'M': - pline("You cannot resist the temptation to mimic a treasure chest."); - tp++; - nomul(-30); - afternmv = Meatdone; - nomovemsg = "You now again prefer mimicking a human."; - u.usym = '$'; - prme(); - break; - } - return(tp); -} diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c deleted file mode 100644 index 0ddd2bd0edb7..000000000000 --- a/games/hack/hack.end.c +++ /dev/null @@ -1,642 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.end.c - version 1.0.3 */ - -#include "hack.h" -#include -#include -#define Sprintf (void) sprintf -extern char plname[], pl_character[]; -extern char *itoa(), *ordin(), *eos(); - -xchar maxdlevel = 1; - -void -done1() -{ - (void) signal(SIGINT,SIG_IGN); - pline("Really quit?"); - if(readchar() != 'y') { - (void) signal(SIGINT,done1); - clrlin(); - (void) fflush(stdout); - if(multi > 0) nomul(0); - return; - } - done("quit"); - /* NOTREACHED */ -} - -int done_stopprint; -int done_hup; - -void -done_intr(){ - done_stopprint++; - (void) signal(SIGINT, SIG_IGN); - (void) signal(SIGQUIT, SIG_IGN); -} - -void -done_hangup(){ - done_hup++; - (void) signal(SIGHUP, SIG_IGN); - done_intr(); -} - -done_in_by(mtmp) register struct monst *mtmp; { -static char buf[BUFSZ]; - pline("You die ..."); - if(mtmp->data->mlet == ' '){ - Sprintf(buf, "the ghost of %s", (char *) mtmp->mextra); - killer = buf; - } else if(mtmp->mnamelth) { - Sprintf(buf, "%s called %s", - mtmp->data->mname, NAME(mtmp)); - killer = buf; - } else if(mtmp->minvis) { - Sprintf(buf, "invisible %s", mtmp->data->mname); - killer = buf; - } else killer = mtmp->data->mname; - done("died"); -} - -/* called with arg "died", "drowned", "escaped", "quit", "choked", "panicked", - "burned", "starved" or "tricked" */ -/* Be careful not to call panic from here! */ -done(st1) -register char *st1; -{ - -#ifdef WIZARD - if(wizard && *st1 == 'd'){ - u.uswldtim = 0; - if(u.uhpmax < 0) u.uhpmax = 100; /* arbitrary */ - u.uhp = u.uhpmax; - pline("For some reason you are still alive."); - flags.move = 0; - if(multi > 0) multi = 0; else multi = -1; - flags.botl = 1; - return; - } -#endif WIZARD - (void) signal(SIGINT, done_intr); - (void) signal(SIGQUIT, done_intr); - (void) signal(SIGHUP, done_hangup); - if(*st1 == 'q' && u.uhp < 1){ - st1 = "died"; - killer = "quit while already on Charon's boat"; - } - if(*st1 == 's') killer = "starvation"; else - if(*st1 == 'd' && st1[1] == 'r') killer = "drowning"; else - if(*st1 == 'p') killer = "panic"; else - if(*st1 == 't') killer = "trickery"; else - if(!index("bcd", *st1)) killer = st1; - paybill(); - clearlocks(); - if(flags.toplin == 1) more(); - if(index("bcds", *st1)){ -#ifdef WIZARD - if(!wizard) -#endif WIZARD - savebones(); - if(!flags.notombstone) - outrip(); - } - if(*st1 == 'c') killer = st1; /* after outrip() */ - settty((char *) 0); /* does a clear_screen() */ - if(!done_stopprint) - printf("Goodbye %s %s...\n\n", pl_character, plname); - { long int tmp; - tmp = u.ugold - u.ugold0; - if(tmp < 0) - tmp = 0; - if(*st1 == 'd' || *st1 == 'b') - tmp -= tmp/10; - u.urexp += tmp; - u.urexp += 50 * maxdlevel; - if(maxdlevel > 20) - u.urexp += 1000*((maxdlevel > 30) ? 10 : maxdlevel - 20); - } - if(*st1 == 'e') { - extern struct monst *mydogs; - register struct monst *mtmp; - register struct obj *otmp; - register int i; - register unsigned worthlessct = 0; - boolean has_amulet = FALSE; - - killer = st1; - keepdogs(); - mtmp = mydogs; - if(mtmp) { - if(!done_stopprint) printf("You"); - while(mtmp) { - if(!done_stopprint) - printf(" and %s", monnam(mtmp)); - if(mtmp->mtame) - u.urexp += mtmp->mhp; - mtmp = mtmp->nmon; - } - if(!done_stopprint) - printf("\nescaped from the dungeon with %ld points,\n", - u.urexp); - } else - if(!done_stopprint) - printf("You escaped from the dungeon with %ld points,\n", - u.urexp); - for(otmp = invent; otmp; otmp = otmp->nobj) { - if(otmp->olet == GEM_SYM){ - objects[otmp->otyp].oc_name_known = 1; - i = otmp->quan*objects[otmp->otyp].g_val; - if(i == 0) { - worthlessct += otmp->quan; - continue; - } - u.urexp += i; - if(!done_stopprint) - printf("\t%s (worth %d Zorkmids),\n", - doname(otmp), i); - } else if(otmp->olet == AMULET_SYM) { - otmp->known = 1; - i = (otmp->spe < 0) ? 2 : 5000; - u.urexp += i; - if(!done_stopprint) - printf("\t%s (worth %d Zorkmids),\n", - doname(otmp), i); - if(otmp->spe >= 0) { - has_amulet = TRUE; - killer = "escaped (with amulet)"; - } - } - } - if(worthlessct) if(!done_stopprint) - printf("\t%u worthless piece%s of coloured glass,\n", - worthlessct, plur(worthlessct)); - if(has_amulet) u.urexp *= 2; - } else - if(!done_stopprint) - printf("You %s on dungeon level %d with %ld points,\n", - st1, dlevel, u.urexp); - if(!done_stopprint) - printf("and %ld piece%s of gold, after %ld move%s.\n", - u.ugold, plur(u.ugold), moves, plur(moves)); - if(!done_stopprint) - printf("You were level %u with a maximum of %d hit points when you %s.\n", - u.ulevel, u.uhpmax, st1); - if(*st1 == 'e' && !done_stopprint){ - getret(); /* all those pieces of coloured glass ... */ - cls(); - } -#ifdef WIZARD - if(!wizard) -#endif WIZARD - topten(); - if(done_stopprint) printf("\n\n"); - exit(0); -} - -#define newttentry() (struct toptenentry *) alloc(sizeof(struct toptenentry)) -#define NAMSZ 8 -#define DTHSZ 40 -#define PERSMAX 1 -#define POINTSMIN 1 /* must be > 0 */ -#define ENTRYMAX 100 /* must be >= 10 */ -#define PERS_IS_UID /* delete for PERSMAX per name; now per uid */ -struct toptenentry { - struct toptenentry *tt_next; - long int points; - int level,maxlvl,hp,maxhp; - int uid; - char plchar; - char sex; - char name[NAMSZ+1]; - char death[DTHSZ+1]; - char date[7]; /* yymmdd */ -} *tt_head; - -topten(){ - int uid = getuid(); - int rank, rank0 = -1, rank1 = 0; - int occ_cnt = PERSMAX; - register struct toptenentry *t0, *t1, *tprev; - char *recfile = RECORD; - char *reclock = "record_lock"; - int sleepct = 300; - FILE *rfile; - register flg = 0; - extern char *getdate(); -#define HUP if(!done_hup) - while(link(recfile, reclock) == -1) { - HUP perror(reclock); - if(!sleepct--) { - HUP puts("I give up. Sorry."); - HUP puts("Perhaps there is an old record_lock around?"); - return; - } - HUP printf("Waiting for access to record file. (%d)\n", - sleepct); - HUP (void) fflush(stdout); - sleep(1); - } - if(!(rfile = fopen(recfile,"r"))){ - HUP puts("Cannot open record file!"); - goto unlock; - } - HUP (void) putchar('\n'); - - /* create a new 'topten' entry */ - t0 = newttentry(); - t0->level = dlevel; - t0->maxlvl = maxdlevel; - t0->hp = u.uhp; - t0->maxhp = u.uhpmax; - t0->points = u.urexp; - t0->plchar = pl_character[0]; - t0->sex = (flags.female ? 'F' : 'M'); - t0->uid = uid; - (void) strncpy(t0->name, plname, NAMSZ); - (t0->name)[NAMSZ] = 0; - (void) strncpy(t0->death, killer, DTHSZ); - (t0->death)[DTHSZ] = 0; - (void) strcpy(t0->date, getdate()); - - /* assure minimum number of points */ - if(t0->points < POINTSMIN) - t0->points = 0; - - t1 = tt_head = newttentry(); - tprev = 0; - /* rank0: -1 undefined, 0 not_on_list, n n_th on list */ - for(rank = 1; ; ) { - if(fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]", - t1->date, &t1->uid, - &t1->level, &t1->maxlvl, - &t1->hp, &t1->maxhp, &t1->points, - &t1->plchar, &t1->sex, t1->name, t1->death) != 11 - || t1->points < POINTSMIN) - t1->points = 0; - if(rank0 < 0 && t1->points < t0->points) { - rank0 = rank++; - if(tprev == 0) - tt_head = t0; - else - tprev->tt_next = t0; - t0->tt_next = t1; - occ_cnt--; - flg++; /* ask for a rewrite */ - } else - tprev = t1; - if(t1->points == 0) break; - if( -#ifdef PERS_IS_UID - t1->uid == t0->uid && -#else - strncmp(t1->name, t0->name, NAMSZ) == 0 && -#endif PERS_IS_UID - t1->plchar == t0->plchar && --occ_cnt <= 0){ - if(rank0 < 0){ - rank0 = 0; - rank1 = rank; - HUP printf("You didn't beat your previous score of %ld points.\n\n", - t1->points); - } - if(occ_cnt < 0){ - flg++; - continue; - } - } - if(rank <= ENTRYMAX){ - t1 = t1->tt_next = newttentry(); - rank++; - } - if(rank > ENTRYMAX){ - t1->points = 0; - break; - } - } - if(flg) { /* rewrite record file */ - (void) fclose(rfile); - if(!(rfile = fopen(recfile,"w"))){ - HUP puts("Cannot write record file\n"); - goto unlock; - } - - if(!done_stopprint) if(rank0 > 0){ - if(rank0 <= 10) - puts("You made the top ten list!\n"); - else - printf("You reached the %d%s place on the top %d list.\n\n", - rank0, ordin(rank0), ENTRYMAX); - } - } - if(rank0 == 0) rank0 = rank1; - if(rank0 <= 0) rank0 = rank; - if(!done_stopprint) outheader(); - t1 = tt_head; - for(rank = 1; t1->points != 0; rank++, t1 = t1->tt_next) { - if(flg) fprintf(rfile,"%6s %d %d %d %d %d %ld %c%c %s,%s\n", - t1->date, t1->uid, - t1->level, t1->maxlvl, - t1->hp, t1->maxhp, t1->points, - t1->plchar, t1->sex, t1->name, t1->death); - if(done_stopprint) continue; - if(rank > flags.end_top && - (rank < rank0-flags.end_around || rank > rank0+flags.end_around) - && (!flags.end_own || -#ifdef PERS_IS_UID - t1->uid != t0->uid )) -#else - strncmp(t1->name, t0->name, NAMSZ))) -#endif PERS_IS_UID - continue; - if(rank == rank0-flags.end_around && - rank0 > flags.end_top+flags.end_around+1 && - !flags.end_own) - (void) putchar('\n'); - if(rank != rank0) - (void) outentry(rank, t1, 0); - else if(!rank1) - (void) outentry(rank, t1, 1); - else { - int t0lth = outentry(0, t0, -1); - int t1lth = outentry(rank, t1, t0lth); - if(t1lth > t0lth) t0lth = t1lth; - (void) outentry(0, t0, t0lth); - } - } - if(rank0 >= rank) if(!done_stopprint) - (void) outentry(0, t0, 1); - (void) fclose(rfile); -unlock: - (void) unlink(reclock); -} - -outheader() { -char linebuf[BUFSZ]; -register char *bp; - (void) strcpy(linebuf, "Number Points Name"); - bp = eos(linebuf); - while(bp < linebuf + COLNO - 9) *bp++ = ' '; - (void) strcpy(bp, "Hp [max]"); - puts(linebuf); -} - -/* so>0: standout line; so=0: ordinary line; so<0: no output, return lth */ -int -outentry(rank,t1,so) register struct toptenentry *t1; { -boolean quit = FALSE, killed = FALSE, starv = FALSE; -char linebuf[BUFSZ]; - linebuf[0] = 0; - if(rank) Sprintf(eos(linebuf), "%3d", rank); - else Sprintf(eos(linebuf), " "); - Sprintf(eos(linebuf), " %6ld %8s", t1->points, t1->name); - if(t1->plchar == 'X') Sprintf(eos(linebuf), " "); - else Sprintf(eos(linebuf), "-%c ", t1->plchar); - if(!strncmp("escaped", t1->death, 7)) { - if(!strcmp(" (with amulet)", t1->death+7)) - Sprintf(eos(linebuf), "escaped the dungeon with amulet"); - else - Sprintf(eos(linebuf), "escaped the dungeon [max level %d]", - t1->maxlvl); - } else { - if(!strncmp(t1->death,"quit",4)) { - quit = TRUE; - if(t1->maxhp < 3*t1->hp && t1->maxlvl < 4) - Sprintf(eos(linebuf), "cravenly gave up"); - else - Sprintf(eos(linebuf), "quit"); - } - else if(!strcmp(t1->death,"choked")) - Sprintf(eos(linebuf), "choked on %s food", - (t1->sex == 'F') ? "her" : "his"); - else if(!strncmp(t1->death,"starv",5)) - Sprintf(eos(linebuf), "starved to death"), starv = TRUE; - else Sprintf(eos(linebuf), "was killed"), killed = TRUE; - Sprintf(eos(linebuf), " on%s level %d", - (killed || starv) ? "" : " dungeon", t1->level); - if(t1->maxlvl != t1->level) - Sprintf(eos(linebuf), " [max %d]", t1->maxlvl); - if(quit && t1->death[4]) Sprintf(eos(linebuf), t1->death + 4); - } - if(killed) Sprintf(eos(linebuf), " by %s%s", - (!strncmp(t1->death, "trick", 5) || !strncmp(t1->death, "the ", 4)) - ? "" : - index(vowels,*t1->death) ? "an " : "a ", - t1->death); - Sprintf(eos(linebuf), "."); - if(t1->maxhp) { - register char *bp = eos(linebuf); - char hpbuf[10]; - int hppos; - Sprintf(hpbuf, (t1->hp > 0) ? itoa(t1->hp) : "-"); - hppos = COLNO - 7 - strlen(hpbuf); - if(bp <= linebuf + hppos) { - while(bp < linebuf + hppos) *bp++ = ' '; - (void) strcpy(bp, hpbuf); - Sprintf(eos(bp), " [%d]", t1->maxhp); - } - } - if(so == 0) puts(linebuf); - else if(so > 0) { - register char *bp = eos(linebuf); - if(so >= COLNO) so = COLNO-1; - while(bp < linebuf + so) *bp++ = ' '; - *bp = 0; - standoutbeg(); - fputs(linebuf,stdout); - standoutend(); - (void) putchar('\n'); - } - return(strlen(linebuf)); -} - -char * -itoa(a) int a; { -static char buf[12]; - Sprintf(buf,"%d",a); - return(buf); -} - -char * -ordin(n) int n; { -register int d = n%10; - return((d==0 || d>3 || n/10==1) ? "th" : (d==1) ? "st" : - (d==2) ? "nd" : "rd"); -} - -clearlocks(){ -register x; - (void) signal(SIGHUP,SIG_IGN); - for(x = maxdlevel; x >= 0; x--) { - glo(x); - (void) unlink(lock); /* not all levels need be present */ - } -} - -#ifdef NOSAVEONHANGUP -hangup() -{ - (void) signal(SIGINT, SIG_IGN); - clearlocks(); - exit(1); -} -#endif NOSAVEONHANGUP - -char * -eos(s) -register char *s; -{ - while(*s) s++; - return(s); -} - -/* it is the callers responsibility to check that there is room for c */ -charcat(s,c) register char *s, c; { - while(*s) s++; - *s++ = c; - *s = 0; -} - -/* - * Called with args from main if argc >= 0. In this case, list scores as - * requested. Otherwise, find scores for the current player (and list them - * if argc == -1). - */ -prscore(argc,argv) int argc; char **argv; { - extern char *hname; - char **players; - int playerct; - int rank; - register struct toptenentry *t1, *t2; - char *recfile = RECORD; - FILE *rfile; - register flg = 0; - register int i; -#ifdef nonsense - long total_score = 0L; - char totchars[10]; - int totcharct = 0; -#endif nonsense - int outflg = (argc >= -1); -#ifdef PERS_IS_UID - int uid = -1; -#else - char *player0; -#endif PERS_IS_UID - - if(!(rfile = fopen(recfile,"r"))){ - puts("Cannot open record file!"); - return; - } - - if(argc > 1 && !strncmp(argv[1], "-s", 2)){ - if(!argv[1][2]){ - argc--; - argv++; - } else if(!argv[1][3] && index("CFKSTWX", argv[1][2])) { - argv[1]++; - argv[1][0] = '-'; - } else argv[1] += 2; - } - if(argc <= 1){ -#ifdef PERS_IS_UID - uid = getuid(); - playerct = 0; -#else - player0 = plname; - if(!*player0) - player0 = "hackplayer"; - playerct = 1; - players = &player0; -#endif PERS_IS_UID - } else { - playerct = --argc; - players = ++argv; - } - if(outflg) putchar('\n'); - - t1 = tt_head = newttentry(); - for(rank = 1; ; rank++) { - if(fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]", - t1->date, &t1->uid, - &t1->level, &t1->maxlvl, - &t1->hp, &t1->maxhp, &t1->points, - &t1->plchar, &t1->sex, t1->name, t1->death) != 11) - t1->points = 0; - if(t1->points == 0) break; -#ifdef PERS_IS_UID - if(!playerct && t1->uid == uid) - flg++; - else -#endif PERS_IS_UID - for(i = 0; i < playerct; i++){ - if(strcmp(players[i], "all") == 0 || - strncmp(t1->name, players[i], NAMSZ) == 0 || - (players[i][0] == '-' && - players[i][1] == t1->plchar && - players[i][2] == 0) || - (digit(players[i][0]) && rank <= atoi(players[i]))) - flg++; - } - t1 = t1->tt_next = newttentry(); - } - (void) fclose(rfile); - if(!flg) { - if(outflg) { - printf("Cannot find any entries for "); - if(playerct < 1) printf("you.\n"); - else { - if(playerct > 1) printf("any of "); - for(i=0; ipoints != 0; rank++, t1 = t2) { - t2 = t1->tt_next; -#ifdef PERS_IS_UID - if(!playerct && t1->uid == uid) - goto outwithit; - else -#endif PERS_IS_UID - for(i = 0; i < playerct; i++){ - if(strcmp(players[i], "all") == 0 || - strncmp(t1->name, players[i], NAMSZ) == 0 || - (players[i][0] == '-' && - players[i][1] == t1->plchar && - players[i][2] == 0) || - (digit(players[i][0]) && rank <= atoi(players[i]))){ - outwithit: - if(outflg) - (void) outentry(rank, t1, 0); -#ifdef nonsense - total_score += t1->points; - if(totcharct < sizeof(totchars)-1) - totchars[totcharct++] = t1->plchar; -#endif nonsense - break; - } - } - free((char *) t1); - } -#ifdef nonsense - totchars[totcharct] = 0; - - /* We would like to determine whether he is experienced. However, - the information collected here only tells about the scores/roles - that got into the topten (top 100?). We should maintain a - .hacklog or something in his home directory. */ - flags.beginner = (total_score < 6000); - for(i=0; i<6; i++) - if(!index(totchars, "CFKSTWX"[i])) { - flags.beginner = 1; - if(!pl_character[0]) pl_character[0] = "CFKSTWX"[i]; - break; - } -#endif nonsense -} diff --git a/games/hack/hack.engrave.c b/games/hack/hack.engrave.c deleted file mode 100644 index dc16c39f952c..000000000000 --- a/games/hack/hack.engrave.c +++ /dev/null @@ -1,306 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.engrave.c - version 1.0.3 */ - -#include "hack.h" - -extern char *nomovemsg; -extern char nul[]; -extern struct obj zeroobj; -struct engr { - struct engr *nxt_engr; - char *engr_txt; - xchar engr_x, engr_y; - unsigned engr_lth; /* for save & restore; not length of text */ - long engr_time; /* moment engraving was (will be) finished */ - xchar engr_type; -#define DUST 1 -#define ENGRAVE 2 -#define BURN 3 -} *head_engr; - -struct engr * -engr_at(x,y) register xchar x,y; { -register struct engr *ep = head_engr; - while(ep) { - if(x == ep->engr_x && y == ep->engr_y) - return(ep); - ep = ep->nxt_engr; - } - return((struct engr *) 0); -} - -sengr_at(s,x,y) register char *s; register xchar x,y; { -register struct engr *ep = engr_at(x,y); -register char *t; -register int n; - if(ep && ep->engr_time <= moves) { - t = ep->engr_txt; -/* - if(!strcmp(s,t)) return(1); -*/ - n = strlen(s); - while(*t) { - if(!strncmp(s,t,n)) return(1); - t++; - } - } - return(0); -} - -u_wipe_engr(cnt) -register int cnt; -{ - if(!u.uswallow && !Levitation) - wipe_engr_at(u.ux, u.uy, cnt); -} - -wipe_engr_at(x,y,cnt) register xchar x,y,cnt; { -register struct engr *ep = engr_at(x,y); -register int lth,pos; -char ch; - if(ep){ - if((ep->engr_type != DUST) || Levitation) { - cnt = rn2(1 + 50/(cnt+1)) ? 0 : 1; - } - lth = strlen(ep->engr_txt); - if(lth && cnt > 0 ) { - while(cnt--) { - pos = rn2(lth); - if((ch = ep->engr_txt[pos]) == ' ') - continue; - ep->engr_txt[pos] = (ch != '?') ? '?' : ' '; - } - } - while(lth && ep->engr_txt[lth-1] == ' ') - ep->engr_txt[--lth] = 0; - while(ep->engr_txt[0] == ' ') - ep->engr_txt++; - if(!ep->engr_txt[0]) del_engr(ep); - } -} - -read_engr_at(x,y) register int x,y; { -register struct engr *ep = engr_at(x,y); - if(ep && ep->engr_txt[0]) { - switch(ep->engr_type) { - case DUST: - pline("Something is written here in the dust."); - break; - case ENGRAVE: - pline("Something is engraved here on the floor."); - break; - case BURN: - pline("Some text has been burned here in the floor."); - break; - default: - impossible("Something is written in a very strange way."); - } - pline("You read: \"%s\".", ep->engr_txt); - } -} - -make_engr_at(x,y,s) -register int x,y; -register char *s; -{ - register struct engr *ep; - - if(ep = engr_at(x,y)) - del_engr(ep); - ep = (struct engr *) - alloc((unsigned)(sizeof(struct engr) + strlen(s) + 1)); - ep->nxt_engr = head_engr; - head_engr = ep; - ep->engr_x = x; - ep->engr_y = y; - ep->engr_txt = (char *)(ep + 1); - (void) strcpy(ep->engr_txt, s); - ep->engr_time = 0; - ep->engr_type = DUST; - ep->engr_lth = strlen(s) + 1; -} - -doengrave(){ -register int len; -register char *sp; -register struct engr *ep, *oep = engr_at(u.ux,u.uy); -char buf[BUFSZ]; -xchar type; -int spct; /* number of leading spaces */ -register struct obj *otmp; - multi = 0; - - if(u.uswallow) { - pline("You're joking. Hahaha!"); /* riv05!a3 */ - return(0); - } - - /* one may write with finger, weapon or wand */ - otmp = getobj("#-)/", "write with"); - if(!otmp) return(0); - - if(otmp == &zeroobj) - otmp = 0; - if(otmp && otmp->otyp == WAN_FIRE && otmp->spe) { - type = BURN; - otmp->spe--; - } else { - /* first wield otmp */ - if(otmp != uwep) { - if(uwep && uwep->cursed) { - /* Andreas Bormann */ - pline("Since your weapon is welded to your hand,"); - pline("you use the %s.", aobjnam(uwep, (char *) 0)); - otmp = uwep; - } else { - if(!otmp) - pline("You are now empty-handed."); - else if(otmp->cursed) - pline("The %s %s to your hand!", - aobjnam(otmp, "weld"), - (otmp->quan == 1) ? "itself" : "themselves"); - else - pline("You now wield %s.", doname(otmp)); - setuwep(otmp); - } - } - - if(!otmp) - type = DUST; - else - if(otmp->otyp == DAGGER || otmp->otyp == TWO_HANDED_SWORD || - otmp->otyp == CRYSKNIFE || - otmp->otyp == LONG_SWORD || otmp->otyp == AXE) { - type = ENGRAVE; - if((int)otmp->spe <= -3) { - type = DUST; - pline("Your %s too dull for engraving.", - aobjnam(otmp, "are")); - if(oep && oep->engr_type != DUST) return(1); - } - } else type = DUST; - } - if(Levitation && type != BURN){ /* riv05!a3 */ - pline("You can't reach the floor!"); - return(1); - } - if(oep && oep->engr_type == DUST){ - pline("You wipe out the message that was written here."); - del_engr(oep); - oep = 0; - } - if(type == DUST && oep){ - pline("You cannot wipe out the message that is %s in the rock.", - (oep->engr_type == BURN) ? "burned" : "engraved"); - return(1); - } - - pline("What do you want to %s on the floor here? ", - (type == ENGRAVE) ? "engrave" : (type == BURN) ? "burn" : "write"); - getlin(buf); - clrlin(); - spct = 0; - sp = buf; - while(*sp == ' ') spct++, sp++; - len = strlen(sp); - if(!len || *buf == '\033') { - if(type == BURN) otmp->spe++; - return(0); - } - - switch(type) { - case DUST: - case BURN: - if(len > 15) { - multi = -(len/10); - nomovemsg = "You finished writing."; - } - break; - case ENGRAVE: /* here otmp != 0 */ - { int len2 = (otmp->spe + 3) * 2 + 1; - - pline("Your %s dull.", aobjnam(otmp, "get")); - if(len2 < len) { - len = len2; - sp[len] = 0; - otmp->spe = -3; - nomovemsg = "You cannot engrave more."; - } else { - otmp->spe -= len/2; - nomovemsg = "You finished engraving."; - } - multi = -len; - } - break; - } - if(oep) len += strlen(oep->engr_txt) + spct; - ep = (struct engr *) alloc((unsigned)(sizeof(struct engr) + len + 1)); - ep->nxt_engr = head_engr; - head_engr = ep; - ep->engr_x = u.ux; - ep->engr_y = u.uy; - sp = (char *)(ep + 1); /* (char *)ep + sizeof(struct engr) */ - ep->engr_txt = sp; - if(oep) { - (void) strcpy(sp, oep->engr_txt); - (void) strcat(sp, buf); - del_engr(oep); - } else - (void) strcpy(sp, buf); - ep->engr_lth = len+1; - ep->engr_type = type; - ep->engr_time = moves-multi; - - /* kludge to protect pline against excessively long texts */ - if(len > BUFSZ-20) sp[BUFSZ-20] = 0; - - return(1); -} - -save_engravings(fd) int fd; { -register struct engr *ep = head_engr; - while(ep) { - if(!ep->engr_lth || !ep->engr_txt[0]){ - ep = ep->nxt_engr; - continue; - } - bwrite(fd, (char *) & (ep->engr_lth), sizeof(ep->engr_lth)); - bwrite(fd, (char *) ep, sizeof(struct engr) + ep->engr_lth); - ep = ep->nxt_engr; - } - bwrite(fd, (char *) nul, sizeof(unsigned)); - head_engr = 0; -} - -rest_engravings(fd) int fd; { -register struct engr *ep; -unsigned lth; - head_engr = 0; - while(1) { - mread(fd, (char *) <h, sizeof(unsigned)); - if(lth == 0) return; - ep = (struct engr *) alloc(sizeof(struct engr) + lth); - mread(fd, (char *) ep, sizeof(struct engr) + lth); - ep->nxt_engr = head_engr; - ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */ - head_engr = ep; - } -} - -del_engr(ep) register struct engr *ep; { -register struct engr *ept; - if(ep == head_engr) - head_engr = ep->nxt_engr; - else { - for(ept = head_engr; ept; ept = ept->nxt_engr) { - if(ept->nxt_engr == ep) { - ept->nxt_engr = ep->nxt_engr; - goto fnd; - } - } - impossible("Error in del_engr?"); - return; - fnd: ; - } - free((char *) ep); -} diff --git a/games/hack/hack.fight.c b/games/hack/hack.fight.c deleted file mode 100644 index ede886d16931..000000000000 --- a/games/hack/hack.fight.c +++ /dev/null @@ -1,358 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.fight.c - version 1.0.3 */ - -#include "hack.h" -extern struct permonst li_dog, dog, la_dog; -extern char *exclam(), *xname(); -extern struct obj *mkobj_at(); - -static boolean far_noise; -static long noisetime; - -/* hitmm returns 0 (miss), 1 (hit), or 2 (kill) */ -hitmm(magr,mdef) register struct monst *magr,*mdef; { -register struct permonst *pa = magr->data, *pd = mdef->data; -int hit; -schar tmp; -boolean vis; - if(index("Eauy", pa->mlet)) return(0); - if(magr->mfroz) return(0); /* riv05!a3 */ - tmp = pd->ac + pa->mlevel; - if(mdef->mconf || mdef->mfroz || mdef->msleep){ - tmp += 4; - if(mdef->msleep) mdef->msleep = 0; - } - hit = (tmp > rnd(20)); - if(hit) mdef->msleep = 0; - vis = (cansee(magr->mx,magr->my) && cansee(mdef->mx,mdef->my)); - if(vis){ - char buf[BUFSZ]; - if(mdef->mimic) seemimic(mdef); - if(magr->mimic) seemimic(magr); - (void) sprintf(buf,"%s %s", Monnam(magr), - hit ? "hits" : "misses"); - pline("%s %s.", buf, monnam(mdef)); - } else { - boolean far = (dist(magr->mx, magr->my) > 15); - if(far != far_noise || moves-noisetime > 10) { - far_noise = far; - noisetime = moves; - pline("You hear some noises%s.", - far ? " in the distance" : ""); - } - } - if(hit){ - if(magr->data->mlet == 'c' && !magr->cham) { - magr->mhpmax += 3; - if(vis) pline("%s is turned to stone!", Monnam(mdef)); - else if(mdef->mtame) - pline("You have a peculiarly sad feeling for a moment, then it passes."); - monstone(mdef); - hit = 2; - } else - if((mdef->mhp -= d(pa->damn,pa->damd)) < 1) { - magr->mhpmax += 1 + rn2(pd->mlevel+1); - if(magr->mtame && magr->mhpmax > 8*pa->mlevel){ - if(pa == &li_dog) magr->data = pa = &dog; - else if(pa == &dog) magr->data = pa = &la_dog; - } - if(vis) pline("%s is killed!", Monnam(mdef)); - else if(mdef->mtame) - pline("You have a sad feeling for a moment, then it passes."); - mondied(mdef); - hit = 2; - } - } - return(hit); -} - -/* drop (perhaps) a cadaver and remove monster */ -mondied(mdef) register struct monst *mdef; { -register struct permonst *pd = mdef->data; - if(letter(pd->mlet) && rn2(3)){ - (void) mkobj_at(pd->mlet,mdef->mx,mdef->my); - if(cansee(mdef->mx,mdef->my)){ - unpmon(mdef); - atl(mdef->mx,mdef->my,fobj->olet); - } - stackobj(fobj); - } - mondead(mdef); -} - -/* drop a rock and remove monster */ -monstone(mdef) register struct monst *mdef; { - extern char mlarge[]; - if(index(mlarge, mdef->data->mlet)) - mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my); - else - mksobj_at(ROCK, mdef->mx, mdef->my); - if(cansee(mdef->mx, mdef->my)){ - unpmon(mdef); - atl(mdef->mx,mdef->my,fobj->olet); - } - mondead(mdef); -} - - -fightm(mtmp) register struct monst *mtmp; { -register struct monst *mon; - for(mon = fmon; mon; mon = mon->nmon) if(mon != mtmp) { - if(DIST(mon->mx,mon->my,mtmp->mx,mtmp->my) < 3) - if(rn2(4)) - return(hitmm(mtmp,mon)); - } - return(-1); -} - -/* u is hit by sth, but not a monster */ -thitu(tlev,dam,name) -register tlev,dam; -register char *name; -{ -char buf[BUFSZ]; - setan(name,buf); - if(u.uac + tlev <= rnd(20)) { - if(Blind) pline("It misses."); - else pline("You are almost hit by %s!", buf); - return(0); - } else { - if(Blind) pline("You are hit!"); - else pline("You are hit by %s!", buf); - losehp(dam,name); - return(1); - } -} - -char mlarge[] = "bCDdegIlmnoPSsTUwY',&"; - -boolean -hmon(mon,obj,thrown) /* return TRUE if mon still alive */ -register struct monst *mon; -register struct obj *obj; -register thrown; -{ - register tmp; - boolean hittxt = FALSE; - - if(!obj){ - tmp = rnd(2); /* attack with bare hands */ - if(mon->data->mlet == 'c' && !uarmg){ - pline("You hit the cockatrice with your bare hands."); - pline("You turn to stone ..."); - done_in_by(mon); - } - } else if(obj->olet == WEAPON_SYM || obj->otyp == PICK_AXE) { - if(obj == uwep && (obj->otyp > SPEAR || obj->otyp < BOOMERANG)) - tmp = rnd(2); - else { - if(index(mlarge, mon->data->mlet)) { - tmp = rnd(objects[obj->otyp].wldam); - if(obj->otyp == TWO_HANDED_SWORD) tmp += d(2,6); - else if(obj->otyp == FLAIL) tmp += rnd(4); - } else { - tmp = rnd(objects[obj->otyp].wsdam); - } - tmp += obj->spe; - if(!thrown && obj == uwep && obj->otyp == BOOMERANG - && !rn2(3)){ - pline("As you hit %s, the boomerang breaks into splinters.", - monnam(mon)); - freeinv(obj); - setworn((struct obj *) 0, obj->owornmask); - obfree(obj, (struct obj *) 0); - tmp++; - } - } - if(mon->data->mlet == 'O' && obj->otyp == TWO_HANDED_SWORD && - !strcmp(ONAME(obj), "Orcrist")) - tmp += rnd(10); - } else switch(obj->otyp) { - case HEAVY_IRON_BALL: - tmp = rnd(25); break; - case EXPENSIVE_CAMERA: - pline("You succeed in destroying your camera. Congratulations!"); - freeinv(obj); - if(obj->owornmask) - setworn((struct obj *) 0, obj->owornmask); - obfree(obj, (struct obj *) 0); - return(TRUE); - case DEAD_COCKATRICE: - pline("You hit %s with the cockatrice corpse.", - monnam(mon)); - if(mon->data->mlet == 'c') { - tmp = 1; - hittxt = TRUE; - break; - } - pline("%s is turned to stone!", Monnam(mon)); - killed(mon); - return(FALSE); - case CLOVE_OF_GARLIC: /* no effect against demons */ - if(index(UNDEAD, mon->data->mlet)) - mon->mflee = 1; - tmp = 1; - break; - default: - /* non-weapons can damage because of their weight */ - /* (but not too much) */ - tmp = obj->owt/10; - if(tmp < 1) tmp = 1; - else tmp = rnd(tmp); - if(tmp > 6) tmp = 6; - } - - /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG) */ - - tmp += u.udaminc + dbon(); - if(u.uswallow) { - if((tmp -= u.uswldtim) <= 0) { - pline("Your arms are no longer able to hit."); - return(TRUE); - } - } - if(tmp < 1) tmp = 1; - mon->mhp -= tmp; - if(mon->mhp < 1) { - killed(mon); - return(FALSE); - } - if(mon->mtame && (!mon->mflee || mon->mfleetim)) { - mon->mflee = 1; /* Rick Richardson */ - mon->mfleetim += 10*rnd(tmp); - } - - if(!hittxt) { - if(thrown) - /* this assumes that we cannot throw plural things */ - hit( xname(obj) /* or: objects[obj->otyp].oc_name */, - mon, exclam(tmp) ); - else if(Blind) - pline("You hit it."); - else - pline("You hit %s%s", monnam(mon), exclam(tmp)); - } - - if(u.umconf && !thrown) { - if(!Blind) { - pline("Your hands stop glowing blue."); - if(!mon->mfroz && !mon->msleep) - pline("%s appears confused.",Monnam(mon)); - } - mon->mconf = 1; - u.umconf = 0; - } - return(TRUE); /* mon still alive */ -} - -/* try to attack; return FALSE if monster evaded */ -/* u.dx and u.dy must be set */ -attack(mtmp) -register struct monst *mtmp; -{ - schar tmp; - boolean malive = TRUE; - register struct permonst *mdat; - mdat = mtmp->data; - - u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe attacks */ - - if(mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep && - !mtmp->mconf && mtmp->mcansee && !rn2(7) && - (m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */ - mtmp->mx != u.ux+u.dx || mtmp->my != u.uy+u.dy)) - return(FALSE); - - if(mtmp->mimic){ - if(!u.ustuck && !mtmp->mflee) u.ustuck = mtmp; - switch(levl[u.ux+u.dx][u.uy+u.dy].scrsym){ - case '+': - pline("The door actually was a Mimic."); - break; - case '$': - pline("The chest was a Mimic!"); - break; - default: - pline("Wait! That's a Mimic!"); - } - wakeup(mtmp); /* clears mtmp->mimic */ - return(TRUE); - } - - wakeup(mtmp); - - if(mtmp->mhide && mtmp->mundetected){ - register struct obj *obj; - - mtmp->mundetected = 0; - if((obj = o_at(mtmp->mx,mtmp->my)) && !Blind) - pline("Wait! There's a %s hiding under %s!", - mdat->mname, doname(obj)); - return(TRUE); - } - - tmp = u.uluck + u.ulevel + mdat->ac + abon(); - if(uwep) { - if(uwep->olet == WEAPON_SYM || uwep->otyp == PICK_AXE) - tmp += uwep->spe; - if(uwep->otyp == TWO_HANDED_SWORD) tmp -= 1; - else if(uwep->otyp == DAGGER) tmp += 2; - else if(uwep->otyp == CRYSKNIFE) tmp += 3; - else if(uwep->otyp == SPEAR && - index("XDne", mdat->mlet)) tmp += 2; - } - if(mtmp->msleep) { - mtmp->msleep = 0; - tmp += 2; - } - if(mtmp->mfroz) { - tmp += 4; - if(!rn2(10)) mtmp->mfroz = 0; - } - if(mtmp->mflee) tmp += 2; - if(u.utrap) tmp -= 3; - - /* with a lot of luggage, your agility diminishes */ - tmp -= (inv_weight() + 40)/20; - - if(tmp <= rnd(20) && !u.uswallow){ - if(Blind) pline("You miss it."); - else pline("You miss %s.",monnam(mtmp)); - } else { - /* we hit the monster; be careful: it might die! */ - - if((malive = hmon(mtmp,uwep,0)) == TRUE) { - /* monster still alive */ - if(!rn2(25) && mtmp->mhp < mtmp->mhpmax/2) { - mtmp->mflee = 1; - if(!rn2(3)) mtmp->mfleetim = rnd(100); - if(u.ustuck == mtmp && !u.uswallow) - u.ustuck = 0; - } -#ifndef NOWORM - if(mtmp->wormno) - cutworm(mtmp, u.ux+u.dx, u.uy+u.dy, - uwep ? uwep->otyp : 0); -#endif NOWORM - } - if(mdat->mlet == 'a') { - if(rn2(2)) { - pline("You are splashed by the blob's acid!"); - losehp_m(rnd(6), mtmp); - if(!rn2(30)) corrode_armor(); - } - if(!rn2(6)) corrode_weapon(); - } - } - if(malive && mdat->mlet == 'E' && canseemon(mtmp) - && !mtmp->mcan && rn2(3)) { - if(mtmp->mcansee) { - pline("You are frozen by the floating eye's gaze!"); - nomul((u.ulevel > 6 || rn2(4)) ? rn1(20,-21) : -200); - } else { - pline("The blinded floating eye cannot defend itself."); - if(!rn2(500)) if((int)u.uluck > LUCKMIN) u.uluck--; - } - } - return(TRUE); -} diff --git a/games/hack/hack.fix b/games/hack/hack.fix deleted file mode 100644 index 01e6460247d7..000000000000 --- a/games/hack/hack.fix +++ /dev/null @@ -1,113 +0,0 @@ -/***** unido:net.games.hack / ab / 7:23 pm Sep 13, 1985*/ - -Recently hack (1.0.3) crashed with core dumps during some good games. -The crashes occured in the onbill-routine. After investigating the core -dump I found that the shopkeeper's bill was still to be paid. Normaly -if you leave a shop the bill will be cleared and onbill() would not -check it. But under certain conditions you can leave a shop without -clearing the bill. The conditions are: - - 1. You have to rob a shop in order to make the shopkeeper - follow you. - - 2. After leaving the shop being followed by the shopkeeper - you must return to the shop... - - 3. ...and then leave the unguarded shop again. - - The shopkeeper mustn't be present! - -If you climb the stairs to the previous level, chances are that your -bill now contains much more items than allowed. If so the next call to -onbill() will dump the core. - -Following is a context diff to fix the bug. Actually just the last hunk -does the fix [it deletes two lines which have been inserted in 1.0.3], -but I think the other fix was intended by the now deleted lines. - - Andreas - --- -Andreas Bormann ab@unido.UUCP -University of Dortmund N 51 29' 05" E 07 24' 42" -West Germany - ------- the diff follows: - -*** hack.shk.c.orig Sun Aug 4 12:07:51 1985 ---- hack.shk.c Fri Sep 13 14:29:52 1985 -*************** -*** 133,139 - /* Did we just leave a shop? */ - if(u.uinshop && - (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { -- u.uinshop = 0; - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { - pline("Somehow you escaped the shop without paying!"); - ---- 133,138 ----- - /* Did we just leave a shop? */ - if(u.uinshop && - (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { - if(inroom(shopkeeper->mx, shopkeeper->my) -*************** -*** 136,142 - u.uinshop = 0; - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { -! pline("Somehow you escaped the shop without paying!"); - addupbill(); - pline("You stole for a total worth of %ld zorkmids.", - total); - ---- 135,143 ----- - (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { -! if(inroom(shopkeeper->mx, shopkeeper->my) -! == u.uinshop - 1) /* ab@unido */ -! pline("Somehow you escaped the shop without paying!"); - addupbill(); - pline("You stole for a total worth of %ld zorkmids.", - total); -*************** -*** 149,154 - shopkeeper = 0; - shlevel = 0; - } - } - - /* Did we just enter a zoo of some kind? */ - ---- 150,156 ----- - shopkeeper = 0; - shlevel = 0; - } -+ u.uinshop = 0; - } - - /* Did we just enter a zoo of some kind? */ -*************** -*** 183,190 - findshk(roomno); - if(!shopkeeper) { - rooms[roomno].rtype = 0; -- u.uinshop = 0; -- } else if(inroom(shopkeeper->mx, shopkeeper->my) != roomno) { - u.uinshop = 0; - } else if(!u.uinshop){ - if(!ESHK(shopkeeper)->visitct || - ---- 185,190 ----- - findshk(roomno); - if(!shopkeeper) { - rooms[roomno].rtype = 0; - u.uinshop = 0; - } else if(!u.uinshop){ - if(!ESHK(shopkeeper)->visitct || -/* ---------- */ - - - diff --git a/games/hack/hack.h b/games/hack/hack.h deleted file mode 100644 index 58c028379ee1..000000000000 --- a/games/hack/hack.h +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.h - version 1.0.3 */ - -#include "config.h" -#include - -#ifndef BSD -#define index strchr -#define rindex strrchr -#endif BSD - -#define Null(type) ((struct type *) 0) - -#include "def.objclass.h" - -typedef struct { - xchar x,y; -} coord; - -#include "def.monst.h" /* uses coord */ -#include "def.gold.h" -#include "def.trap.h" -#include "def.obj.h" -#include "def.flag.h" - -#define plur(x) (((x) == 1) ? "" : "s") - -#define BUFSZ 256 /* for getlin buffers */ -#define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ - -#include "def.rm.h" -#include "def.permonst.h" - -extern long *alloc(); - -extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ - -extern xchar dlevel; -#define newstring(x) (char *) alloc((unsigned)(x)) -#include "hack.onames.h" - -#define ON 1 -#define OFF 0 - -extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg, - *uleft, *uright, *fcobj; -extern struct obj *uchain; /* defined iff PUNISHED */ -extern struct obj *uball; /* defined if PUNISHED */ -struct obj *o_at(), *getobj(), *sobj_at(); - -struct prop { -#define TIMEOUT 007777 /* mask */ -#define LEFT_RING W_RINGL /* 010000L */ -#define RIGHT_RING W_RINGR /* 020000L */ -#define INTRINSIC 040000L -#define LEFT_SIDE LEFT_RING -#define RIGHT_SIDE RIGHT_RING -#define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) - long p_flgs; - int (*p_tofn)(); /* called after timeout */ -}; - -struct you { - xchar ux, uy; - schar dx, dy, dz; /* direction of move (or zap or ... ) */ -#ifdef QUEST - schar di; /* direction of FF */ - xchar ux0, uy0; /* initial position FF */ -#endif QUEST - xchar udisx, udisy; /* last display pos */ - char usym; /* usually '@' */ - schar uluck; -#define LUCKMAX 10 /* on moonlit nights 11 */ -#define LUCKMIN (-10) - int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */ - /* +: turn right, -: turn left */ - unsigned udispl:1; /* @ on display */ - unsigned ulevel:4; /* 1 - 14 */ -#ifdef QUEST - unsigned uhorizon:7; -#endif QUEST - unsigned utrap:3; /* trap timeout */ - unsigned utraptype:1; /* defined if utrap nonzero */ -#define TT_BEARTRAP 0 -#define TT_PIT 1 - unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */ - - -/* perhaps these #define's should also be generated by makedefs */ -#define TELEPAT LAST_RING /* not a ring */ -#define Telepat u.uprops[TELEPAT].p_flgs -#define FAST (LAST_RING+1) /* not a ring */ -#define Fast u.uprops[FAST].p_flgs -#define CONFUSION (LAST_RING+2) /* not a ring */ -#define Confusion u.uprops[CONFUSION].p_flgs -#define INVIS (LAST_RING+3) /* not a ring */ -#define Invis u.uprops[INVIS].p_flgs -#define Invisible (Invis && !See_invisible) -#define GLIB (LAST_RING+4) /* not a ring */ -#define Glib u.uprops[GLIB].p_flgs -#define PUNISHED (LAST_RING+5) /* not a ring */ -#define Punished u.uprops[PUNISHED].p_flgs -#define SICK (LAST_RING+6) /* not a ring */ -#define Sick u.uprops[SICK].p_flgs -#define BLIND (LAST_RING+7) /* not a ring */ -#define Blind u.uprops[BLIND].p_flgs -#define WOUNDED_LEGS (LAST_RING+8) /* not a ring */ -#define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs -#define STONED (LAST_RING+9) /* not a ring */ -#define Stoned u.uprops[STONED].p_flgs -#define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ - unsigned umconf:1; - char *usick_cause; - struct prop uprops[LAST_RING+10]; - - unsigned uswallow:1; /* set if swallowed by a monster */ - unsigned uswldtim:4; /* time you have been swallowed */ - unsigned uhs:3; /* hunger state - see hack.eat.c */ - schar ustr,ustrmax; - schar udaminc; - schar uac; - int uhp,uhpmax; - long int ugold,ugold0,uexp,urexp; - int uhunger; /* refd only in eat.c and shk.c */ - int uinvault; - struct monst *ustuck; - int nr_killed[CMNUM+2]; /* used for experience bookkeeping */ -}; - -extern struct you u; - -extern char *traps[]; -extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(), - *doname(), *aobjnam(); -extern char readchar(); -extern char vowels[]; - -extern xchar curx,cury; /* cursor location on screen */ - -extern coord bhitpos; /* place where thrown weapon falls to the ground */ - -extern xchar seehx,seelx,seehy,seely; /* where to see*/ -extern char *save_cm,*killer; - -extern xchar dlevel, maxdlevel; /* dungeon level */ - -extern long moves; - -extern int multi; - - -extern char lock[]; - - -#define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2))) - -#define PL_CSIZ 20 /* sizeof pl_character */ -#define MAX_CARR_CAP 120 /* so that boulders can be heavier */ -#define MAXLEVEL 40 -#define FAR (COLNO+2) /* position outside screen */ diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c deleted file mode 100644 index 66949b87afe1..000000000000 --- a/games/hack/hack.invent.c +++ /dev/null @@ -1,863 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.invent.c - version 1.0.3 */ - -#include "hack.h" -#include -extern struct obj *splitobj(); -extern struct obj zeroobj; -extern char morc; -extern char quitchars[]; -static char *xprname(); - -#ifndef NOWORM -#include "def.wseg.h" -extern struct wseg *wsegs[32]; -#endif NOWORM - -#define NOINVSYM '#' - -static int lastinvnr = 51; /* 0 ... 51 */ -static -assigninvlet(otmp) -register struct obj *otmp; -{ - boolean inuse[52]; - register int i; - register struct obj *obj; - - for(i = 0; i < 52; i++) inuse[i] = FALSE; - for(obj = invent; obj; obj = obj->nobj) if(obj != otmp) { - i = obj->invlet; - if('a' <= i && i <= 'z') inuse[i - 'a'] = TRUE; else - if('A' <= i && i <= 'Z') inuse[i - 'A' + 26] = TRUE; - if(i == otmp->invlet) otmp->invlet = 0; - } - if((i = otmp->invlet) && - (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z'))) - return; - for(i = lastinvnr+1; i != lastinvnr; i++) { - if(i == 52) { i = -1; continue; } - if(!inuse[i]) break; - } - otmp->invlet = (inuse[i] ? NOINVSYM : - (i < 26) ? ('a'+i) : ('A'+i-26)); - lastinvnr = i; -} - -struct obj * -addinv(obj) -register struct obj *obj; -{ - register struct obj *otmp; - - /* merge or attach to end of chain */ - if(!invent) { - invent = obj; - otmp = 0; - } else - for(otmp = invent; /* otmp */; otmp = otmp->nobj) { - if(merged(otmp, obj, 0)) - return(otmp); - if(!otmp->nobj) { - otmp->nobj = obj; - break; - } - } - obj->nobj = 0; - - if(flags.invlet_constant) { - assigninvlet(obj); - /* - * The ordering of the chain is nowhere significant - * so in case you prefer some other order than the - * historical one, change the code below. - */ - if(otmp) { /* find proper place in chain */ - otmp->nobj = 0; - if((invent->invlet ^ 040) > (obj->invlet ^ 040)) { - obj->nobj = invent; - invent = obj; - } else - for(otmp = invent; ; otmp = otmp->nobj) { - if(!otmp->nobj || - (otmp->nobj->invlet ^ 040) > (obj->invlet ^ 040)){ - obj->nobj = otmp->nobj; - otmp->nobj = obj; - break; - } - } - } - } - - return(obj); -} - -useup(obj) -register struct obj *obj; -{ - if(obj->quan > 1){ - obj->quan--; - obj->owt = weight(obj); - } else { - setnotworn(obj); - freeinv(obj); - obfree(obj, (struct obj *) 0); - } -} - -freeinv(obj) -register struct obj *obj; -{ - register struct obj *otmp; - - if(obj == invent) - invent = invent->nobj; - else { - for(otmp = invent; otmp->nobj != obj; otmp = otmp->nobj) - if(!otmp->nobj) panic("freeinv"); - otmp->nobj = obj->nobj; - } -} - -/* destroy object in fobj chain (if unpaid, it remains on the bill) */ -delobj(obj) register struct obj *obj; { - freeobj(obj); - unpobj(obj); - obfree(obj, (struct obj *) 0); -} - -/* unlink obj from chain starting with fobj */ -freeobj(obj) register struct obj *obj; { - register struct obj *otmp; - - if(obj == fobj) fobj = fobj->nobj; - else { - for(otmp = fobj; otmp->nobj != obj; otmp = otmp->nobj) - if(!otmp) panic("error in freeobj"); - otmp->nobj = obj->nobj; - } -} - -/* Note: freegold throws away its argument! */ -freegold(gold) register struct gold *gold; { - register struct gold *gtmp; - - if(gold == fgold) fgold = gold->ngold; - else { - for(gtmp = fgold; gtmp->ngold != gold; gtmp = gtmp->ngold) - if(!gtmp) panic("error in freegold"); - gtmp->ngold = gold->ngold; - } - free((char *) gold); -} - -deltrap(trap) -register struct trap *trap; -{ - register struct trap *ttmp; - - if(trap == ftrap) - ftrap = ftrap->ntrap; - else { - for(ttmp = ftrap; ttmp->ntrap != trap; ttmp = ttmp->ntrap) ; - ttmp->ntrap = trap->ntrap; - } - free((char *) trap); -} - -struct wseg *m_atseg; - -struct monst * -m_at(x,y) -register x,y; -{ - register struct monst *mtmp; -#ifndef NOWORM - register struct wseg *wtmp; -#endif NOWORM - - m_atseg = 0; - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){ - if(mtmp->mx == x && mtmp->my == y) - return(mtmp); -#ifndef NOWORM - if(mtmp->wormno){ - for(wtmp = wsegs[mtmp->wormno]; wtmp; wtmp = wtmp->nseg) - if(wtmp->wx == x && wtmp->wy == y){ - m_atseg = wtmp; - return(mtmp); - } - } -#endif NOWORM - } - return(0); -} - -struct obj * -o_at(x,y) -register x,y; -{ - register struct obj *otmp; - - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(otmp->ox == x && otmp->oy == y) return(otmp); - return(0); -} - -struct obj * -sobj_at(n,x,y) -register n,x,y; -{ - register struct obj *otmp; - - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(otmp->ox == x && otmp->oy == y && otmp->otyp == n) - return(otmp); - return(0); -} - -carried(obj) register struct obj *obj; { -register struct obj *otmp; - for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp == obj) return(1); - return(0); -} - -carrying(type) -register int type; -{ - register struct obj *otmp; - - for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp->otyp == type) - return(TRUE); - return(FALSE); -} - -struct obj * -o_on(id, objchn) unsigned int id; register struct obj *objchn; { - while(objchn) { - if(objchn->o_id == id) return(objchn); - objchn = objchn->nobj; - } - return((struct obj *) 0); -} - -struct trap * -t_at(x,y) -register x,y; -{ - register struct trap *trap = ftrap; - while(trap) { - if(trap->tx == x && trap->ty == y) return(trap); - trap = trap->ntrap; - } - return(0); -} - -struct gold * -g_at(x,y) -register x,y; -{ - register struct gold *gold = fgold; - while(gold) { - if(gold->gx == x && gold->gy == y) return(gold); - gold = gold->ngold; - } - return(0); -} - -/* make dummy object structure containing gold - for temporary use only */ -struct obj * -mkgoldobj(q) -register long q; -{ - register struct obj *otmp; - - otmp = newobj(0); - /* should set o_id etc. but otmp will be freed soon */ - otmp->olet = '$'; - u.ugold -= q; - OGOLD(otmp) = q; - flags.botl = 1; - return(otmp); -} - -/* - * getobj returns: - * struct obj *xxx: object to do something with. - * (struct obj *) 0 error return: no object. - * &zeroobj explicitly no object (as in w-). - */ -struct obj * -getobj(let,word) -register char *let,*word; -{ - register struct obj *otmp; - register char ilet,ilet1,ilet2; - char buf[BUFSZ]; - char lets[BUFSZ]; - register int foo = 0, foo2; - register char *bp = buf; - xchar allowcnt = 0; /* 0, 1 or 2 */ - boolean allowgold = FALSE; - boolean allowall = FALSE; - boolean allownone = FALSE; - xchar foox = 0; - long cnt; - - if(*let == '0') let++, allowcnt = 1; - if(*let == '$') let++, allowgold = TRUE; - if(*let == '#') let++, allowall = TRUE; - if(*let == '-') let++, allownone = TRUE; - if(allownone) *bp++ = '-'; - if(allowgold) *bp++ = '$'; - if(bp > buf && bp[-1] == '-') *bp++ = ' '; - - ilet = 'a'; - for(otmp = invent; otmp; otmp = otmp->nobj){ - if(!*let || index(let, otmp->olet)) { - bp[foo++] = flags.invlet_constant ? otmp->invlet : ilet; - - /* ugly check: remove inappropriate things */ - if((!strcmp(word, "take off") && - !(otmp->owornmask & (W_ARMOR - W_ARM2))) - || (!strcmp(word, "wear") && - (otmp->owornmask & (W_ARMOR | W_RING))) - || (!strcmp(word, "wield") && - (otmp->owornmask & W_WEP))) { - foo--; - foox++; - } - } - if(ilet == 'z') ilet = 'A'; else ilet++; - } - bp[foo] = 0; - if(foo == 0 && bp > buf && bp[-1] == ' ') *--bp = 0; - (void) strcpy(lets, bp); /* necessary since we destroy buf */ - if(foo > 5) { /* compactify string */ - foo = foo2 = 1; - ilet2 = bp[0]; - ilet1 = bp[1]; - while(ilet = bp[++foo2] = bp[++foo]){ - if(ilet == ilet1+1){ - if(ilet1 == ilet2+1) - bp[foo2 - 1] = ilet1 = '-'; - else if(ilet2 == '-') { - bp[--foo2] = ++ilet1; - continue; - } - } - ilet2 = ilet1; - ilet1 = ilet; - } - } - if(!foo && !allowall && !allowgold && !allownone) { - pline("You don't have anything %sto %s.", - foox ? "else " : "", word); - return(0); - } - for(;;) { - if(!buf[0]) - pline("What do you want to %s [*]? ", word); - else - pline("What do you want to %s [%s or ?*]? ", - word, buf); - - cnt = 0; - ilet = readchar(); - while(digit(ilet) && allowcnt) { - if (cnt < 100000000) - cnt = 10*cnt + (ilet - '0'); - else - cnt = 999999999; - allowcnt = 2; /* signal presence of cnt */ - ilet = readchar(); - } - if(digit(ilet)) { - pline("No count allowed with this command."); - continue; - } - if(index(quitchars,ilet)) - return((struct obj *)0); - if(ilet == '-') { - return(allownone ? &zeroobj : (struct obj *) 0); - } - if(ilet == '$') { - if(!allowgold){ - pline("You cannot %s gold.", word); - continue; - } - if(!(allowcnt == 2 && cnt < u.ugold)) - cnt = u.ugold; - return(mkgoldobj(cnt)); - } - if(ilet == '?') { - doinv(lets); - if(!(ilet = morc)) continue; - /* he typed a letter (not a space) to more() */ - } else if(ilet == '*') { - doinv((char *) 0); - if(!(ilet = morc)) continue; - /* ... */ - } - if(flags.invlet_constant) { - for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp->invlet == ilet) break; - } else { - if(ilet >= 'A' && ilet <= 'Z') ilet += 'z'-'A'+1; - ilet -= 'a'; - for(otmp = invent; otmp && ilet; - ilet--, otmp = otmp->nobj) ; - } - if(!otmp) { - pline("You don't have that object."); - continue; - } - if(cnt < 0 || otmp->quan < cnt) { - pline("You don't have that many! [You have %u]" - , otmp->quan); - continue; - } - break; - } - if(!allowall && let && !index(let,otmp->olet)) { - pline("That is a silly thing to %s.",word); - return(0); - } - if(allowcnt == 2) { /* cnt given */ - if(cnt == 0) return(0); - if(cnt != otmp->quan) { - register struct obj *obj; - obj = splitobj(otmp, (int) cnt); - if(otmp == uwep) setuwep(obj); - } - } - return(otmp); -} - -ckunpaid(otmp) register struct obj *otmp; { - return( otmp->unpaid ); -} - -/* interactive version of getobj - used for Drop and Identify */ -/* return the number of times fn was called successfully */ -ggetobj(word, fn, max) -char *word; -int (*fn)(), max; -{ -char buf[BUFSZ]; -register char *ip; -register char sym; -register int oletct = 0, iletct = 0; -register boolean allflag = FALSE; -char olets[20], ilets[20]; -int (*ckfn)() = (int (*)()) 0; -xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */ - if(!invent && !allowgold){ - pline("You have nothing to %s.", word); - return(0); - } else { - register struct obj *otmp = invent; - register int uflg = 0; - - if(allowgold) ilets[iletct++] = '$'; - ilets[iletct] = 0; - while(otmp) { - if(!index(ilets, otmp->olet)){ - ilets[iletct++] = otmp->olet; - ilets[iletct] = 0; - } - if(otmp->unpaid) uflg = 1; - otmp = otmp->nobj; - } - ilets[iletct++] = ' '; - if(uflg) ilets[iletct++] = 'u'; - if(invent) ilets[iletct++] = 'a'; - ilets[iletct] = 0; - } - pline("What kinds of thing do you want to %s? [%s] ", - word, ilets); - getlin(buf); - if(buf[0] == '\033') { - clrlin(); - return(0); - } - ip = buf; - olets[0] = 0; - while(sym = *ip++){ - if(sym == ' ') continue; - if(sym == '$') { - if(allowgold == 1) - (*fn)(mkgoldobj(u.ugold)); - else if(!u.ugold) - pline("You have no gold."); - allowgold = 2; - } else - if(sym == 'a' || sym == 'A') allflag = TRUE; else - if(sym == 'u' || sym == 'U') ckfn = ckunpaid; else - if(index("!%?[()=*/\"0", sym)){ - if(!index(olets, sym)){ - olets[oletct++] = sym; - olets[oletct] = 0; - } - } - else pline("You don't have any %c's.", sym); - } - if(allowgold == 2 && !oletct) - return(1); /* he dropped gold (or at least tried to) */ - else - return(askchain(invent, olets, allflag, fn, ckfn, max)); -} - -/* - * Walk through the chain starting at objchn and ask for all objects - * with olet in olets (if nonNULL) and satisfying ckfn (if nonNULL) - * whether the action in question (i.e., fn) has to be performed. - * If allflag then no questions are asked. Max gives the max nr of - * objects to be treated. Return the number of objects treated. - */ -askchain(objchn, olets, allflag, fn, ckfn, max) -struct obj *objchn; -register char *olets; -int allflag; -int (*fn)(), (*ckfn)(); -int max; -{ -register struct obj *otmp, *otmp2; -register char sym, ilet; -register int cnt = 0; - ilet = 'a'-1; - for(otmp = objchn; otmp; otmp = otmp2){ - if(ilet == 'z') ilet = 'A'; else ilet++; - otmp2 = otmp->nobj; - if(olets && *olets && !index(olets, otmp->olet)) continue; - if(ckfn && !(*ckfn)(otmp)) continue; - if(!allflag) { - pline(xprname(otmp, ilet)); - addtopl(" [nyaq]? "); - sym = readchar(); - } - else sym = 'y'; - - switch(sym){ - case 'a': - allflag = 1; - case 'y': - cnt += (*fn)(otmp); - if(--max == 0) goto ret; - case 'n': - default: - break; - case 'q': - goto ret; - } - } - pline(cnt ? "That was all." : "No applicable objects."); -ret: - return(cnt); -} - -obj_to_let(obj) /* should of course only be called for things in invent */ -register struct obj *obj; -{ - register struct obj *otmp; - register char ilet; - - if(flags.invlet_constant) - return(obj->invlet); - ilet = 'a'; - for(otmp = invent; otmp && otmp != obj; otmp = otmp->nobj) - if(++ilet > 'z') ilet = 'A'; - return(otmp ? ilet : NOINVSYM); -} - -prinv(obj) -register struct obj *obj; -{ - pline(xprname(obj, obj_to_let(obj))); -} - -static char * -xprname(obj,let) -register struct obj *obj; -register char let; -{ - static char li[BUFSZ]; - - (void) sprintf(li, "%c - %s.", - flags.invlet_constant ? obj->invlet : let, - doname(obj)); - return(li); -} - -ddoinv() -{ - doinv((char *) 0); - return(0); -} - -/* called with 0 or "": all objects in inventory */ -/* otherwise: all objects with (serial) letter in lets */ -doinv(lets) -register char *lets; -{ - register struct obj *otmp; - register char ilet; - int ct = 0; - char any[BUFSZ]; - - morc = 0; /* just to be sure */ - - if(!invent){ - pline("Not carrying anything."); - return; - } - - cornline(0, (char *) 0); - ilet = 'a'; - for(otmp = invent; otmp; otmp = otmp->nobj) { - if(flags.invlet_constant) ilet = otmp->invlet; - if(!lets || !*lets || index(lets, ilet)) { - cornline(1, xprname(otmp, ilet)); - any[ct++] = ilet; - } - if(!flags.invlet_constant) if(++ilet > 'z') ilet = 'A'; - } - any[ct] = 0; - cornline(2, any); -} - -dotypeinv () /* free after Robert Viduya */ -/* Changed to one type only, so he doesnt have to type cr */ -{ - char c, ilet; - char stuff[BUFSZ]; - register int stct; - register struct obj *otmp; - boolean billx = inshop() && doinvbill(0); - boolean unpd = FALSE; - - if (!invent && !u.ugold && !billx) { - pline ("You aren't carrying anything."); - return(0); - } - - stct = 0; - if(u.ugold) stuff[stct++] = '$'; - stuff[stct] = 0; - for(otmp = invent; otmp; otmp = otmp->nobj) { - if (!index (stuff, otmp->olet)) { - stuff[stct++] = otmp->olet; - stuff[stct] = 0; - } - if(otmp->unpaid) - unpd = TRUE; - } - if(unpd) stuff[stct++] = 'u'; - if(billx) stuff[stct++] = 'x'; - stuff[stct] = 0; - - if(stct > 1) { - pline ("What type of object [%s] do you want an inventory of? ", - stuff); - c = readchar(); - if(index(quitchars,c)) return(0); - } else - c = stuff[0]; - - if(c == '$') - return(doprgold()); - - if(c == 'x' || c == 'X') { - if(billx) - (void) doinvbill(1); - else - pline("No used-up objects on the shopping bill."); - return(0); - } - - if((c == 'u' || c == 'U') && !unpd) { - pline("You are not carrying any unpaid objects."); - return(0); - } - - stct = 0; - ilet = 'a'; - for (otmp = invent; otmp; otmp = otmp -> nobj) { - if(flags.invlet_constant) ilet = otmp->invlet; - if (c == otmp -> olet || (c == 'u' && otmp -> unpaid)) - stuff[stct++] = ilet; - if(!flags.invlet_constant) if(++ilet > 'z') ilet = 'A'; - } - stuff[stct] = '\0'; - if(stct == 0) - pline("You have no such objects."); - else - doinv (stuff); - - return(0); -} - -/* look at what is here */ -dolook() { - register struct obj *otmp, *otmp0; - register struct gold *gold; - char *verb = Blind ? "feel" : "see"; - int ct = 0; - - if(!u.uswallow) { - if(Blind) { - pline("You try to feel what is lying here on the floor."); - if(Levitation) { /* ab@unido */ - pline("You cannot reach the floor!"); - return(1); - } - } - otmp0 = o_at(u.ux, u.uy); - gold = g_at(u.ux, u.uy); - } - - if(u.uswallow || (!otmp0 && !gold)) { - pline("You %s no objects here.", verb); - return(!!Blind); - } - - cornline(0, "Things that are here:"); - for(otmp = otmp0; otmp; otmp = otmp->nobj) { - if(otmp->ox == u.ux && otmp->oy == u.uy) { - ct++; - cornline(1, doname(otmp)); - if(Blind && otmp->otyp == DEAD_COCKATRICE && !uarmg) { - pline("Touching the dead cockatrice is a fatal mistake ..."); - pline("You die ..."); - killer = "dead cockatrice"; - done("died"); - } - } - } - - if(gold) { - char gbuf[30]; - - (void) sprintf(gbuf, "%ld gold piece%s", - gold->amount, plur(gold->amount)); - if(!ct++) - pline("You %s here %s.", verb, gbuf); - else - cornline(1, gbuf); - } - - if(ct == 1 && !gold) { - pline("You %s here %s.", verb, doname(otmp0)); - cornline(3, (char *) 0); - } - if(ct > 1) - cornline(2, (char *) 0); - return(!!Blind); -} - -stackobj(obj) register struct obj *obj; { -register struct obj *otmp = fobj; - for(otmp = fobj; otmp; otmp = otmp->nobj) if(otmp != obj) - if(otmp->ox == obj->ox && otmp->oy == obj->oy && - merged(obj,otmp,1)) - return; -} - -/* merge obj with otmp and delete obj if types agree */ -merged(otmp,obj,lose) register struct obj *otmp, *obj; { - if(obj->otyp == otmp->otyp && - obj->unpaid == otmp->unpaid && - obj->spe == otmp->spe && - obj->dknown == otmp->dknown && - obj->cursed == otmp->cursed && - (index("%*?!", obj->olet) || - (obj->known == otmp->known && - (obj->olet == WEAPON_SYM && obj->otyp < BOOMERANG)))) { - otmp->quan += obj->quan; - otmp->owt += obj->owt; - if(lose) freeobj(obj); - obfree(obj,otmp); /* free(obj), bill->otmp */ - return(1); - } else return(0); -} - -/* - * Gold is no longer displayed; in fact, when you have a lot of money, - * it may take a while before you have counted it all. - * [Bug: d$ and pickup still tell you how much it was.] - */ -extern int (*occupation)(); -extern char *occtxt; -static long goldcounted; - -countgold(){ - if((goldcounted += 100*(u.ulevel + 1)) >= u.ugold) { - long eps = 0; - if(!rn2(2)) eps = rnd((int) (u.ugold/100 + 1)); - pline("You probably have about %ld gold pieces.", - u.ugold + eps); - return(0); /* done */ - } - return(1); /* continue */ -} - -doprgold(){ - if(!u.ugold) - pline("You do not carry any gold."); - else if(u.ugold <= 500) - pline("You are carrying %ld gold pieces.", u.ugold); - else { - pline("You sit down in order to count your gold pieces."); - goldcounted = 500; - occupation = countgold; - occtxt = "counting your gold"; - } - return(1); -} - -/* --- end of gold counting section --- */ - -doprwep(){ - if(!uwep) pline("You are empty handed."); - else prinv(uwep); - return(0); -} - -doprarm(){ - if(!uarm && !uarmg && !uarms && !uarmh) - pline("You are not wearing any armor."); - else { - char lets[6]; - register int ct = 0; - - if(uarm) lets[ct++] = obj_to_let(uarm); - if(uarm2) lets[ct++] = obj_to_let(uarm2); - if(uarmh) lets[ct++] = obj_to_let(uarmh); - if(uarms) lets[ct++] = obj_to_let(uarms); - if(uarmg) lets[ct++] = obj_to_let(uarmg); - lets[ct] = 0; - doinv(lets); - } - return(0); -} - -doprring(){ - if(!uleft && !uright) - pline("You are not wearing any rings."); - else { - char lets[3]; - register int ct = 0; - - if(uleft) lets[ct++] = obj_to_let(uleft); - if(uright) lets[ct++] = obj_to_let(uright); - lets[ct] = 0; - doinv(lets); - } - return(0); -} - -digit(c) char c; { - return(c >= '0' && c <= '9'); -} diff --git a/games/hack/hack.ioctl.c b/games/hack/hack.ioctl.c deleted file mode 100644 index 6669ceaba363..000000000000 --- a/games/hack/hack.ioctl.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.ioctl.c - version 1.0.2 */ - -/* This cannot be part of hack.tty.c (as it was earlier) since on some - systems (e.g. MUNIX) the include files and - define the same constants, and the C preprocessor complains. */ -#include -#include "config.h" -#ifdef BSD -#include -struct ltchars ltchars, ltchars0; -#else -#include /* also includes part of */ -struct termio termio; -#endif BSD - -getioctls() { -#ifdef BSD - (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); - (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0); -#else - (void) ioctl(fileno(stdin), (int) TCGETA, &termio); -#endif BSD -} - -setioctls() { -#ifdef BSD - (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); -#else - (void) ioctl(fileno(stdin), (int) TCSETA, &termio); -#endif BSD -} - -#ifdef SUSPEND /* implies BSD */ -dosuspend() { -#include -#ifdef SIGTSTP - if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { - settty((char *) 0); - (void) signal(SIGTSTP, SIG_DFL); - (void) kill(0, SIGTSTP); - gettty(); - setftty(); - docrt(); - } else { - pline("I don't think your shell has job control."); - } -#else SIGTSTP - pline("Sorry, it seems we have no SIGTSTP here. Try ! or S."); -#endif SIGTSTP - return(0); -} -#endif SUSPEND diff --git a/games/hack/hack.lev.c b/games/hack/hack.lev.c deleted file mode 100644 index f011f675fb8a..000000000000 --- a/games/hack/hack.lev.c +++ /dev/null @@ -1,285 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.lev.c - version 1.0.3 */ - -#include "hack.h" -#include "def.mkroom.h" -#include -extern struct monst *restmonchn(); -extern struct obj *restobjchn(); -extern struct obj *billobjs; -extern char *itoa(); -extern char SAVEF[]; -extern int hackpid; -extern xchar dlevel; -extern char nul[]; - -#ifndef NOWORM -#include "def.wseg.h" -extern struct wseg *wsegs[32], *wheads[32]; -extern long wgrowtime[32]; -#endif NOWORM - -boolean level_exists[MAXLEVEL+1]; - -savelev(fd,lev) -int fd; -xchar lev; -{ -#ifndef NOWORM - register struct wseg *wtmp, *wtmp2; - register tmp; -#endif NOWORM - - if(fd < 0) panic("Save on bad file!"); /* impossible */ - if(lev >= 0 && lev <= MAXLEVEL) - level_exists[lev] = TRUE; - - bwrite(fd,(char *) &hackpid,sizeof(hackpid)); - bwrite(fd,(char *) &lev,sizeof(lev)); - bwrite(fd,(char *) levl,sizeof(levl)); - bwrite(fd,(char *) &moves,sizeof(long)); - bwrite(fd,(char *) &xupstair,sizeof(xupstair)); - bwrite(fd,(char *) &yupstair,sizeof(yupstair)); - bwrite(fd,(char *) &xdnstair,sizeof(xdnstair)); - bwrite(fd,(char *) &ydnstair,sizeof(ydnstair)); - savemonchn(fd, fmon); - savegoldchn(fd, fgold); - savetrapchn(fd, ftrap); - saveobjchn(fd, fobj); - saveobjchn(fd, billobjs); - billobjs = 0; - save_engravings(fd); -#ifndef QUEST - bwrite(fd,(char *) rooms,sizeof(rooms)); - bwrite(fd,(char *) doors,sizeof(doors)); -#endif QUEST - fgold = 0; - ftrap = 0; - fmon = 0; - fobj = 0; -#ifndef NOWORM - bwrite(fd,(char *) wsegs,sizeof(wsegs)); - for(tmp=1; tmp<32; tmp++){ - for(wtmp = wsegs[tmp]; wtmp; wtmp = wtmp2){ - wtmp2 = wtmp->nseg; - bwrite(fd,(char *) wtmp,sizeof(struct wseg)); - } - wsegs[tmp] = 0; - } - bwrite(fd,(char *) wgrowtime,sizeof(wgrowtime)); -#endif NOWORM -} - -bwrite(fd,loc,num) -register fd; -register char *loc; -register unsigned num; -{ -/* lint wants the 3rd arg of write to be an int; lint -p an unsigned */ - if(write(fd, loc, (int) num) != num) - panic("cannot write %u bytes to file #%d", num, fd); -} - -saveobjchn(fd,otmp) -register fd; -register struct obj *otmp; -{ - register struct obj *otmp2; - unsigned xl; - int minusone = -1; - - while(otmp) { - otmp2 = otmp->nobj; - xl = otmp->onamelth; - bwrite(fd, (char *) &xl, sizeof(int)); - bwrite(fd, (char *) otmp, xl + sizeof(struct obj)); - free((char *) otmp); - otmp = otmp2; - } - bwrite(fd, (char *) &minusone, sizeof(int)); -} - -savemonchn(fd,mtmp) -register fd; -register struct monst *mtmp; -{ - register struct monst *mtmp2; - unsigned xl; - int minusone = -1; - struct permonst *monbegin = &mons[0]; - - bwrite(fd, (char *) &monbegin, sizeof(monbegin)); - - while(mtmp) { - mtmp2 = mtmp->nmon; - xl = mtmp->mxlth + mtmp->mnamelth; - bwrite(fd, (char *) &xl, sizeof(int)); - bwrite(fd, (char *) mtmp, xl + sizeof(struct monst)); - if(mtmp->minvent) saveobjchn(fd,mtmp->minvent); - free((char *) mtmp); - mtmp = mtmp2; - } - bwrite(fd, (char *) &minusone, sizeof(int)); -} - -savegoldchn(fd,gold) -register fd; -register struct gold *gold; -{ - register struct gold *gold2; - while(gold) { - gold2 = gold->ngold; - bwrite(fd, (char *) gold, sizeof(struct gold)); - free((char *) gold); - gold = gold2; - } - bwrite(fd, nul, sizeof(struct gold)); -} - -savetrapchn(fd,trap) -register fd; -register struct trap *trap; -{ - register struct trap *trap2; - while(trap) { - trap2 = trap->ntrap; - bwrite(fd, (char *) trap, sizeof(struct trap)); - free((char *) trap); - trap = trap2; - } - bwrite(fd, nul, sizeof(struct trap)); -} - -getlev(fd,pid,lev) -int fd,pid; -xchar lev; -{ - register struct gold *gold; - register struct trap *trap; -#ifndef NOWORM - register struct wseg *wtmp; -#endif NOWORM - register tmp; - long omoves; - int hpid; - xchar dlvl; - - /* First some sanity checks */ - mread(fd, (char *) &hpid, sizeof(hpid)); - mread(fd, (char *) &dlvl, sizeof(dlvl)); - if((pid && pid != hpid) || (lev && dlvl != lev)) { - pline("Strange, this map is not as I remember it."); - pline("Somebody is trying some trickery here ..."); - pline("This game is void ..."); - done("tricked"); - } - - fgold = 0; - ftrap = 0; - mread(fd, (char *) levl, sizeof(levl)); - mread(fd, (char *)&omoves, sizeof(omoves)); - mread(fd, (char *)&xupstair, sizeof(xupstair)); - mread(fd, (char *)&yupstair, sizeof(yupstair)); - mread(fd, (char *)&xdnstair, sizeof(xdnstair)); - mread(fd, (char *)&ydnstair, sizeof(ydnstair)); - - fmon = restmonchn(fd); - - /* regenerate animals while on another level */ - { long tmoves = (moves > omoves) ? moves-omoves : 0; - register struct monst *mtmp, *mtmp2; - extern char genocided[]; - - for(mtmp = fmon; mtmp; mtmp = mtmp2) { - long newhp; /* tmoves may be very large */ - - mtmp2 = mtmp->nmon; - if(index(genocided, mtmp->data->mlet)) { - mondead(mtmp); - continue; - } - - if(mtmp->mtame && tmoves > 250) { - mtmp->mtame = 0; - mtmp->mpeaceful = 0; - } - - newhp = mtmp->mhp + - (index(MREGEN, mtmp->data->mlet) ? tmoves : tmoves/20); - if(newhp > mtmp->mhpmax) - mtmp->mhp = mtmp->mhpmax; - else - mtmp->mhp = newhp; - } - } - - setgd(); - gold = newgold(); - mread(fd, (char *)gold, sizeof(struct gold)); - while(gold->gx) { - gold->ngold = fgold; - fgold = gold; - gold = newgold(); - mread(fd, (char *)gold, sizeof(struct gold)); - } - free((char *) gold); - trap = newtrap(); - mread(fd, (char *)trap, sizeof(struct trap)); - while(trap->tx) { - trap->ntrap = ftrap; - ftrap = trap; - trap = newtrap(); - mread(fd, (char *)trap, sizeof(struct trap)); - } - free((char *) trap); - fobj = restobjchn(fd); - billobjs = restobjchn(fd); - rest_engravings(fd); -#ifndef QUEST - mread(fd, (char *)rooms, sizeof(rooms)); - mread(fd, (char *)doors, sizeof(doors)); -#endif QUEST -#ifndef NOWORM - mread(fd, (char *)wsegs, sizeof(wsegs)); - for(tmp = 1; tmp < 32; tmp++) if(wsegs[tmp]){ - wheads[tmp] = wsegs[tmp] = wtmp = newseg(); - while(1) { - mread(fd, (char *)wtmp, sizeof(struct wseg)); - if(!wtmp->nseg) break; - wheads[tmp]->nseg = wtmp = newseg(); - wheads[tmp] = wtmp; - } - } - mread(fd, (char *)wgrowtime, sizeof(wgrowtime)); -#endif NOWORM -} - -mread(fd, buf, len) -register fd; -register char *buf; -register unsigned len; -{ - register int rlen; - extern boolean restoring; - - rlen = read(fd, buf, (int) len); - if(rlen != len){ - pline("Read %d instead of %u bytes.\n", rlen, len); - if(restoring) { - (void) unlink(SAVEF); - error("Error restoring old game."); - } - panic("Error reading level file."); - } -} - -mklev() -{ - extern boolean in_mklev; - - if(getbones()) return; - - in_mklev = TRUE; - makelevel(); - in_mklev = FALSE; -} diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c deleted file mode 100644 index d2d59a2f3356..000000000000 --- a/games/hack/hack.main.c +++ /dev/null @@ -1,499 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.main.c - version 1.0.3 */ - -#include -#include -#include "hack.h" - -#ifdef QUEST -#define gamename "quest" -#else -#define gamename "hack" -#endif - -extern char *getlogin(), *getenv(); -extern char plname[PL_NSIZ], pl_character[PL_CSIZ]; -extern struct permonst mons[CMNUM+2]; -extern char genocided[], fut_geno[]; - -int (*afternmv)(); -int (*occupation)(); -char *occtxt; /* defined when occupation != NULL */ - -void done1(); -void hangup(); - -int hackpid; /* current pid */ -int locknum; /* max num of players */ -#ifdef DEF_PAGER -char *catmore; /* default pager */ -#endif -char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */ -char *hname; /* name of the game (argv[0] of call) */ -char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ - -extern char *nomovemsg; -extern long wailmsg; - -#ifdef CHDIR -static void chdirx(); -#endif - -main(argc,argv) -int argc; -char *argv[]; -{ - register int fd; -#ifdef CHDIR - register char *dir; -#endif - - hname = argv[0]; - hackpid = getpid(); - -#ifdef CHDIR /* otherwise no chdir() */ - /* - * See if we must change directory to the playground. - * (Perhaps hack runs suid and playground is inaccessible - * for the player.) - * The environment variable HACKDIR is overridden by a - * -d command line option (must be the first option given) - */ - - dir = getenv("HACKDIR"); - if(argc > 1 && !strncmp(argv[1], "-d", 2)) { - argc--; - argv++; - dir = argv[0]+2; - if(*dir == '=' || *dir == ':') dir++; - if(!*dir && argc > 1) { - argc--; - argv++; - dir = argv[0]; - } - if(!*dir) - error("Flag -d must be followed by a directory name."); - } -#endif - - /* - * Who am i? Algorithm: 1. Use name as specified in HACKOPTIONS - * 2. Use $USER or $LOGNAME (if 1. fails) - * 3. Use getlogin() (if 2. fails) - * The resulting name is overridden by command line options. - * If everything fails, or if the resulting name is some generic - * account like "games", "play", "player", "hack" then eventually - * we'll ask him. - * Note that we trust him here; it is possible to play under - * somebody else's name. - */ - { register char *s; - - initoptions(); - if(!*plname && (s = getenv("USER"))) - (void) strncpy(plname, s, sizeof(plname)-1); - if(!*plname && (s = getenv("LOGNAME"))) - (void) strncpy(plname, s, sizeof(plname)-1); - if(!*plname && (s = getlogin())) - (void) strncpy(plname, s, sizeof(plname)-1); - } - - /* - * Now we know the directory containing 'record' and - * may do a prscore(). - */ - if(argc > 1 && !strncmp(argv[1], "-s", 2)) { -#ifdef CHDIR - chdirx(dir,0); -#endif - prscore(argc, argv); - exit(0); - } - - /* - * It seems he really wants to play. - * Remember tty modes, to be restored on exit. - */ - gettty(); - setbuf(stdout,obuf); - setrandom(); - startup(); - cls(); - u.uhp = 1; /* prevent RIP on early quits */ - u.ux = FAR; /* prevent nscr() */ - (void) signal(SIGHUP, hangup); - - /* - * Find the creation date of this game, - * so as to avoid restoring outdated savefiles. - */ - gethdate(hname); - - /* - * We cannot do chdir earlier, otherwise gethdate will fail. - */ -#ifdef CHDIR - chdirx(dir,1); -#endif - - /* - * Process options. - */ - while(argc > 1 && argv[1][0] == '-'){ - argv++; - argc--; - switch(argv[0][1]){ -#ifdef WIZARD - case 'D': -/* if(!strcmp(getlogin(), WIZARD)) */ - wizard = TRUE; -/* else - printf("Sorry.\n"); */ - break; -#endif -#ifdef NEWS - case 'n': - flags.nonews = TRUE; - break; -#endif - case 'u': - if(argv[0][2]) - (void) strncpy(plname, argv[0]+2, sizeof(plname)-1); - else if(argc > 1) { - argc--; - argv++; - (void) strncpy(plname, argv[0], sizeof(plname)-1); - } else - printf("Player name expected after -u\n"); - break; - default: - /* allow -T for Tourist, etc. */ - (void) strncpy(pl_character, argv[0]+1, - sizeof(pl_character)-1); - - /* printf("Unknown option: %s\n", *argv); */ - } - } - - if(argc > 1) - locknum = atoi(argv[1]); -#ifdef MAX_NR_OF_PLAYERS - if(!locknum || locknum > MAX_NR_OF_PLAYERS) - locknum = MAX_NR_OF_PLAYERS; -#endif -#ifdef DEF_PAGER - if(!(catmore = getenv("HACKPAGER")) && !(catmore = getenv("PAGER"))) - catmore = DEF_PAGER; -#endif -#ifdef MAIL - getmailstatus(); -#endif -#ifdef WIZARD - if(wizard) (void) strcpy(plname, "wizard"); else -#endif - if(!*plname || !strncmp(plname, "player", 4) - || !strncmp(plname, "games", 4)) - askname(); - plnamesuffix(); /* strip suffix from name; calls askname() */ - /* again if suffix was whole name */ - /* accepts any suffix */ -#ifdef WIZARD - if(!wizard) { -#endif - /* - * check for multiple games under the same name - * (if !locknum) or check max nr of players (otherwise) - */ - (void) signal(SIGQUIT,SIG_IGN); - (void) signal(SIGINT,SIG_IGN); - if(!locknum) - (void) strcpy(lock,plname); - getlock(); /* sets lock if locknum != 0 */ -#ifdef WIZARD - } else { - register char *sfoo; - (void) strcpy(lock,plname); - if(sfoo = getenv("MAGIC")) - while(*sfoo) { - switch(*sfoo++) { - case 'n': (void) srandom(*sfoo++); - break; - } - } - if(sfoo = getenv("GENOCIDED")){ - if(*sfoo == '!'){ - register struct permonst *pm = mons; - register char *gp = genocided; - - while(pm < mons+CMNUM+2){ - if(!index(sfoo, pm->mlet)) - *gp++ = pm->mlet; - pm++; - } - *gp = 0; - } else - (void) strcpy(genocided, sfoo); - (void) strcpy(fut_geno, genocided); - } - } -#endif - setftty(); - (void) sprintf(SAVEF, "save/%d%s", getuid(), plname); - regularize(SAVEF+5); /* avoid . or / in name */ - if((fd = open(SAVEF,0)) >= 0 && - (uptodate(fd) || unlink(SAVEF) == 666)) { - (void) signal(SIGINT,done1); - pline("Restoring old save file..."); - (void) fflush(stdout); - if(!dorecover(fd)) - goto not_recovered; - pline("Hello %s, welcome to %s!", plname, gamename); - flags.move = 0; - } else { -not_recovered: - fobj = fcobj = invent = 0; - fmon = fallen_down = 0; - ftrap = 0; - fgold = 0; - flags.ident = 1; - init_objects(); - u_init(); - - (void) signal(SIGINT,done1); - mklev(); - u.ux = xupstair; - u.uy = yupstair; - (void) inshop(); - setsee(); - flags.botlx = 1; - makedog(); - { register struct monst *mtmp; - if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp); /* riv05!a3 */ - } - seemons(); -#ifdef NEWS - if(flags.nonews || !readnews()) - /* after reading news we did docrt() already */ -#endif - docrt(); - - /* give welcome message before pickup messages */ - pline("Hello %s, welcome to %s!", plname, gamename); - - pickup(1); - read_engr_at(u.ux,u.uy); - flags.move = 1; - } - - flags.moonphase = phase_of_the_moon(); - if(flags.moonphase == FULL_MOON) { - pline("You are lucky! Full moon tonight."); - u.uluck++; - } else if(flags.moonphase == NEW_MOON) { - pline("Be careful! New moon tonight."); - } - - initrack(); - - for(;;) { - if(flags.move) { /* actual time passed */ - - settrack(); - - if(moves%2 == 0 || - (!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) { - extern struct monst *makemon(); - movemon(); - if(!rn2(70)) - (void) makemon((struct permonst *)0, 0, 0); - } - if(Glib) glibr(); - timeout(); - ++moves; - if(flags.time) flags.botl = 1; - if(u.uhp < 1) { - pline("You die..."); - done("died"); - } - if(u.uhp*10 < u.uhpmax && moves-wailmsg > 50){ - wailmsg = moves; - if(u.uhp == 1) - pline("You hear the wailing of the Banshee..."); - else - pline("You hear the howling of the CwnAnnwn..."); - } - if(u.uhp < u.uhpmax) { - if(u.ulevel > 9) { - if(Regeneration || !(moves%3)) { - flags.botl = 1; - u.uhp += rnd((int) u.ulevel-9); - if(u.uhp > u.uhpmax) - u.uhp = u.uhpmax; - } - } else if(Regeneration || - (!(moves%(22-u.ulevel*2)))) { - flags.botl = 1; - u.uhp++; - } - } - if(Teleportation && !rn2(85)) tele(); - if(Searching && multi >= 0) (void) dosearch(); - gethungry(); - invault(); - amulet(); - } - if(multi < 0) { - if(!++multi){ - pline(nomovemsg ? nomovemsg : - "You can move again."); - nomovemsg = 0; - if(afternmv) (*afternmv)(); - afternmv = 0; - } - } - - find_ac(); -#ifndef QUEST - if(!flags.mv || Blind) -#endif - { - seeobjs(); - seemons(); - nscr(); - } - if(flags.botl || flags.botlx) bot(); - - flags.move = 1; - - if(multi >= 0 && occupation) { - if(monster_nearby()) - stop_occupation(); - else if ((*occupation)() == 0) - occupation = 0; - continue; - } - - if(multi > 0) { -#ifdef QUEST - if(flags.run >= 4) finddir(); -#endif - lookaround(); - if(!multi) { /* lookaround may clear multi */ - flags.move = 0; - continue; - } - if(flags.mv) { - if(multi < COLNO && !--multi) - flags.mv = flags.run = 0; - domove(); - } else { - --multi; - rhack(save_cm); - } - } else if(multi == 0) { -#ifdef MAIL - ckmailstatus(); -#endif - rhack((char *) 0); - } - if(multi && multi%7 == 0) - (void) fflush(stdout); - } -} - -glo(foo) -register foo; -{ - /* construct the string xlock.n */ - register char *tf; - - tf = lock; - while(*tf && *tf != '.') tf++; - (void) sprintf(tf, ".%d", foo); -} - -/* - * plname is filled either by an option (-u Player or -uPlayer) or - * explicitly (-w implies wizard) or by askname. - * It may still contain a suffix denoting pl_character. - */ -askname(){ -register int c,ct; - printf("\nWho are you? "); - (void) fflush(stdout); - ct = 0; - while((c = getchar()) != '\n'){ - if(c == EOF) error("End of input\n"); - /* some people get confused when their erase char is not ^H */ - if(c == '\010') { - if(ct) ct--; - continue; - } - if(c != '-') - if(c < 'A' || (c > 'Z' && c < 'a') || c > 'z') c = '_'; - if(ct < sizeof(plname)-1) plname[ct++] = c; - } - plname[ct] = 0; - if(ct == 0) askname(); -} - -/*VARARGS1*/ -impossible(s,x1,x2) -register char *s; -{ - pline(s,x1,x2); - pline("Program in disorder - perhaps you'd better Quit."); -} - -#ifdef CHDIR -static void -chdirx(dir, wr) -char *dir; -boolean wr; -{ - -#ifdef SECURE - if(dir /* User specified directory? */ -#ifdef HACKDIR - && strcmp(dir, HACKDIR) /* and not the default? */ -#endif - ) { - (void) setuid(getuid()); /* Ron Wessels */ - (void) setgid(getgid()); - } -#endif - -#ifdef HACKDIR - if(dir == NULL) - dir = HACKDIR; -#endif - - if(dir && chdir(dir) < 0) { - perror(dir); - error("Cannot chdir to %s.", dir); - } - - /* warn the player if he cannot write the record file */ - /* perhaps we should also test whether . is writable */ - /* unfortunately the access systemcall is worthless */ - if(wr) { - register fd; - - if(dir == NULL) - dir = "."; - if((fd = open(RECORD, 2)) < 0) { - printf("Warning: cannot write %s/%s", dir, RECORD); - getret(); - } else - (void) close(fd); - } -} -#endif - -stop_occupation() -{ - if(occupation) { - pline("You stop %s.", occtxt); - occupation = 0; - } -} diff --git a/games/hack/hack.makemon.c b/games/hack/hack.makemon.c deleted file mode 100644 index bcf23b621d74..000000000000 --- a/games/hack/hack.makemon.c +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.makemon.c - version 1.0.2 */ - -#include "hack.h" -extern char fut_geno[]; -extern char *index(); -extern struct obj *mkobj_at(); -struct monst zeromonst; - -/* - * called with [x,y] = coordinates; - * [0,0] means anyplace - * [u.ux,u.uy] means: call mnexto (if !in_mklev) - * - * In case we make an Orc or killer bee, we make an entire horde (swarm); - * note that in this case we return only one of them (the one at [x,y]). - */ -struct monst * -makemon(ptr,x,y) -register struct permonst *ptr; -{ - register struct monst *mtmp; - register tmp, ct; - boolean anything = (!ptr); - extern boolean in_mklev; - - if(x != 0 || y != 0) if(m_at(x,y)) return((struct monst *) 0); - if(ptr){ - if(index(fut_geno, ptr->mlet)) return((struct monst *) 0); - } else { - ct = CMNUM - strlen(fut_geno); - if(index(fut_geno, 'm')) ct++; /* make only 1 minotaur */ - if(index(fut_geno, '@')) ct++; - if(ct <= 0) return(0); /* no more monsters! */ - tmp = rn2(ct*dlevel/24 + 7); - if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12); - if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2); - for(ct = 0; ct < CMNUM; ct++){ - ptr = &mons[ct]; - if(index(fut_geno, ptr->mlet)) - continue; - if(!tmp--) goto gotmon; - } - panic("makemon?"); - } -gotmon: - mtmp = newmonst(ptr->pxlth); - *mtmp = zeromonst; /* clear all entries in structure */ - for(ct = 0; ct < ptr->pxlth; ct++) - ((char *) &(mtmp->mextra[0]))[ct] = 0; - mtmp->nmon = fmon; - fmon = mtmp; - mtmp->m_id = flags.ident++; - mtmp->data = ptr; - mtmp->mxlth = ptr->pxlth; - if(ptr->mlet == 'D') mtmp->mhpmax = mtmp->mhp = 80; - else if(!ptr->mlevel) mtmp->mhpmax = mtmp->mhp = rnd(4); - else mtmp->mhpmax = mtmp->mhp = d(ptr->mlevel, 8); - mtmp->mx = x; - mtmp->my = y; - mtmp->mcansee = 1; - if(ptr->mlet == 'M'){ - mtmp->mimic = 1; - mtmp->mappearance = ']'; - } - if(!in_mklev) { - if(x == u.ux && y == u.uy && ptr->mlet != ' ') - mnexto(mtmp); - if(x == 0 && y == 0) - rloc(mtmp); - } - if(ptr->mlet == 's' || ptr->mlet == 'S') { - mtmp->mhide = mtmp->mundetected = 1; - if(in_mklev) - if(mtmp->mx && mtmp->my) - (void) mkobj_at(0, mtmp->mx, mtmp->my); - } - if(ptr->mlet == ':') { - mtmp->cham = 1; - (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]); - } - if(ptr->mlet == 'I' || ptr->mlet == ';') - mtmp->minvis = 1; - if(ptr->mlet == 'L' || ptr->mlet == 'N' - || (in_mklev && index("&w;", ptr->mlet) && rn2(5)) - ) mtmp->msleep = 1; - -#ifndef NOWORM - if(ptr->mlet == 'w' && getwn(mtmp)) - initworm(mtmp); -#endif NOWORM - - if(anything) if(ptr->mlet == 'O' || ptr->mlet == 'k') { - coord enexto(); - coord mm; - register int cnt = rnd(10); - mm.x = x; - mm.y = y; - while(cnt--) { - mm = enexto(mm.x, mm.y); - (void) makemon(ptr, mm.x, mm.y); - } - } - - return(mtmp); -} - -coord -enexto(xx,yy) -register xchar xx,yy; -{ - register xchar x,y; - coord foo[15], *tfoo; - int range; - - tfoo = foo; - range = 1; - do { /* full kludge action. */ - for(x = xx-range; x <= xx+range; x++) - if(goodpos(x, yy-range)) { - tfoo->x = x; - tfoo++->y = yy-range; - if(tfoo == &foo[15]) goto foofull; - } - for(x = xx-range; x <= xx+range; x++) - if(goodpos(x,yy+range)) { - tfoo->x = x; - tfoo++->y = yy+range; - if(tfoo == &foo[15]) goto foofull; - } - for(y = yy+1-range; y < yy+range; y++) - if(goodpos(xx-range,y)) { - tfoo->x = xx-range; - tfoo++->y = y; - if(tfoo == &foo[15]) goto foofull; - } - for(y = yy+1-range; y < yy+range; y++) - if(goodpos(xx+range,y)) { - tfoo->x = xx+range; - tfoo++->y = y; - if(tfoo == &foo[15]) goto foofull; - } - range++; - } while(tfoo == foo); -foofull: - return( foo[rn2(tfoo-foo)] ); -} - -goodpos(x,y) /* used only in mnexto and rloc */ -{ - return( - ! (x < 1 || x > COLNO-2 || y < 1 || y > ROWNO-2 || - m_at(x,y) || !ACCESSIBLE(levl[x][y].typ) - || (x == u.ux && y == u.uy) - || sobj_at(ENORMOUS_ROCK, x, y) - )); -} - -rloc(mtmp) -struct monst *mtmp; -{ - register tx,ty; - register char ch = mtmp->data->mlet; - -#ifndef NOWORM - if(ch == 'w' && mtmp->mx) return; /* do not relocate worms */ -#endif NOWORM - do { - tx = rn1(COLNO-3,2); - ty = rn2(ROWNO); - } while(!goodpos(tx,ty)); - mtmp->mx = tx; - mtmp->my = ty; - if(u.ustuck == mtmp){ - if(u.uswallow) { - u.ux = tx; - u.uy = ty; - docrt(); - } else u.ustuck = 0; - } - pmon(mtmp); -} - -struct monst * -mkmon_at(let,x,y) -char let; -register int x,y; -{ - register int ct; - register struct permonst *ptr; - - for(ct = 0; ct < CMNUM; ct++) { - ptr = &mons[ct]; - if(ptr->mlet == let) - return(makemon(ptr,x,y)); - } - return(0); -} diff --git a/games/hack/hack.mfndpos.h b/games/hack/hack.mfndpos.h deleted file mode 100644 index f4da529fc7fc..000000000000 --- a/games/hack/hack.mfndpos.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mfndpos.h - version 1.0.2 */ - -#define ALLOW_TRAPS 0777 -#define ALLOW_U 01000 -#define ALLOW_M 02000 -#define ALLOW_TM 04000 -#define ALLOW_ALL (ALLOW_U | ALLOW_M | ALLOW_TM | ALLOW_TRAPS) -#define ALLOW_SSM 010000 -#define ALLOW_ROCK 020000 -#define NOTONL 040000 -#define NOGARLIC 0100000 diff --git a/games/hack/hack.mhitu.c b/games/hack/hack.mhitu.c deleted file mode 100644 index ae7d204b17e7..000000000000 --- a/games/hack/hack.mhitu.c +++ /dev/null @@ -1,363 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mhitu.c - version 1.0.3 */ - -#include "hack.h" -extern struct monst *makemon(); - -/* - * mhitu: monster hits you - * returns 1 if monster dies (e.g. 'y', 'F'), 0 otherwise - */ -mhitu(mtmp) -register struct monst *mtmp; -{ - register struct permonst *mdat = mtmp->data; - register int tmp, ctmp; - - nomul(0); - - /* If swallowed, can only be affected by hissers and by u.ustuck */ - if(u.uswallow) { - if(mtmp != u.ustuck) { - if(mdat->mlet == 'c' && !rn2(13)) { - pline("Outside, you hear %s's hissing!", - monnam(mtmp)); - pline("%s gets turned to stone!", - Monnam(u.ustuck)); - pline("And the same fate befalls you."); - done_in_by(mtmp); - /* "notreached": not return(1); */ - } - return(0); - } - switch(mdat->mlet) { /* now mtmp == u.ustuck */ - case ',': - youswld(mtmp, (u.uac > 0) ? u.uac+4 : 4, - 5, "The trapper"); - break; - case '\'': - youswld(mtmp,rnd(6),7,"The lurker above"); - break; - case 'P': - youswld(mtmp,d(2,4),12,"The purple worm"); - break; - default: - /* This is not impossible! */ - pline("The mysterious monster totally digests you."); - u.uhp = 0; - } - if(u.uhp < 1) done_in_by(mtmp); - return(0); - } - - if(mdat->mlet == 'c' && Stoned) - return(0); - - /* make eels visible the moment they hit/miss us */ - if(mdat->mlet == ';' && mtmp->minvis && cansee(mtmp->mx,mtmp->my)){ - mtmp->minvis = 0; - pmon(mtmp); - } - if(!index("1&DuxynNF",mdat->mlet)) - tmp = hitu(mtmp,d(mdat->damn,mdat->damd)); - else - tmp = 0; - if(index(UNDEAD, mdat->mlet) && midnight()) - tmp += hitu(mtmp,d(mdat->damn,mdat->damd)); - - ctmp = tmp && !mtmp->mcan && - (!uarm || objects[uarm->otyp].a_can < rnd(3) || !rn2(50)); - switch(mdat->mlet) { - case '1': - if(wiz_hit(mtmp)) return(1); /* he disappeared */ - break; - case '&': - if(!mtmp->cham && !mtmp->mcan && !rn2(13)) { - (void) makemon(PM_DEMON,u.ux,u.uy); - } else { - (void) hitu(mtmp,d(2,6)); - (void) hitu(mtmp,d(2,6)); - (void) hitu(mtmp,rnd(3)); - (void) hitu(mtmp,rnd(3)); - (void) hitu(mtmp,rn1(4,2)); - } - break; - case ',': - if(tmp) justswld(mtmp,"The trapper"); - break; - case '\'': - if(tmp) justswld(mtmp, "The lurker above"); - break; - case ';': - if(ctmp) { - if(!u.ustuck && !rn2(10)) { - pline("%s swings itself around you!", - Monnam(mtmp)); - u.ustuck = mtmp; - } else if(u.ustuck == mtmp && - levl[mtmp->mx][mtmp->my].typ == POOL) { - pline("%s drowns you ...", Monnam(mtmp)); - done("drowned"); - } - } - break; - case 'A': - if(ctmp && rn2(2)) { - if(Poison_resistance) - pline("The sting doesn't seem to affect you."); - else { - pline("You feel weaker!"); - losestr(1); - } - } - break; - case 'C': - (void) hitu(mtmp,rnd(6)); - break; - case 'c': - if(!rn2(5)) { - pline("You hear %s's hissing!", monnam(mtmp)); - if(ctmp || !rn2(20) || (flags.moonphase == NEW_MOON - && !carrying(DEAD_LIZARD))) { - Stoned = 5; - /* pline("You get turned to stone!"); */ - /* done_in_by(mtmp); */ - } - } - break; - case 'D': - if(rn2(6) || mtmp->mcan) { - (void) hitu(mtmp,d(3,10)); - (void) hitu(mtmp,rnd(8)); - (void) hitu(mtmp,rnd(8)); - break; - } - kludge("%s breathes fire!","The dragon"); - buzz(-1,mtmp->mx,mtmp->my,u.ux-mtmp->mx,u.uy-mtmp->my); - break; - case 'd': - (void) hitu(mtmp,d(2, (flags.moonphase == FULL_MOON) ? 3 : 4)); - break; - case 'e': - (void) hitu(mtmp,d(3,6)); - break; - case 'F': - if(mtmp->mcan) break; - kludge("%s explodes!","The freezing sphere"); - if(Cold_resistance) pline("You don't seem affected by it."); - else { - xchar dn; - if(17-(u.ulevel/2) > rnd(20)) { - pline("You get blasted!"); - dn = 6; - } else { - pline("You duck the blast..."); - dn = 3; - } - losehp_m(d(dn,6), mtmp); - } - mondead(mtmp); - return(1); - case 'g': - if(ctmp && multi >= 0 && !rn2(3)) { - kludge("You are frozen by %ss juices","the cube'"); - nomul(-rnd(10)); - } - break; - case 'h': - if(ctmp && multi >= 0 && !rn2(5)) { - nomul(-rnd(10)); - kludge("You are put to sleep by %ss bite!", - "the homunculus'"); - } - break; - case 'j': - tmp = hitu(mtmp,rnd(3)); - tmp &= hitu(mtmp,rnd(3)); - if(tmp){ - (void) hitu(mtmp,rnd(4)); - (void) hitu(mtmp,rnd(4)); - } - break; - case 'k': - if((hitu(mtmp,rnd(4)) || !rn2(3)) && ctmp){ - poisoned("bee's sting",mdat->mname); - } - break; - case 'L': - if(tmp) stealgold(mtmp); - break; - case 'N': - if(mtmp->mcan && !Blind) { - pline("%s tries to seduce you, but you seem not interested.", - Amonnam(mtmp, "plain")); - if(rn2(3)) rloc(mtmp); - } else if(steal(mtmp)) { - rloc(mtmp); - mtmp->mflee = 1; - } - break; - case 'n': - if(!uwep && !uarm && !uarmh && !uarms && !uarmg) { - pline("%s hits! (I hope you don't mind)", - Monnam(mtmp)); - u.uhp += rnd(7); - if(!rn2(7)) u.uhpmax++; - if(u.uhp > u.uhpmax) u.uhp = u.uhpmax; - flags.botl = 1; - if(!rn2(50)) rloc(mtmp); - } else { - (void) hitu(mtmp,d(2,6)); - (void) hitu(mtmp,d(2,6)); - } - break; - case 'o': - tmp = hitu(mtmp,rnd(6)); - if(hitu(mtmp,rnd(6)) && tmp && /* hits with both paws */ - !u.ustuck && rn2(2)) { - u.ustuck = mtmp; - kludge("%s has grabbed you!","The owlbear"); - u.uhp -= d(2,8); - } else if(u.ustuck == mtmp) { - u.uhp -= d(2,8); - pline("You are being crushed."); - } - break; - case 'P': - if(ctmp && !rn2(4)) - justswld(mtmp,"The purple worm"); - else - (void) hitu(mtmp,d(2,4)); - break; - case 'Q': - (void) hitu(mtmp,rnd(2)); - (void) hitu(mtmp,rnd(2)); - break; - case 'R': - if(tmp && uarmh && !uarmh->rustfree && - (int) uarmh->spe >= -1) { - pline("Your helmet rusts!"); - uarmh->spe--; - } else - if(ctmp && uarm && !uarm->rustfree && /* Mike Newton */ - uarm->otyp < STUDDED_LEATHER_ARMOR && - (int) uarm->spe >= -1) { - pline("Your armor rusts!"); - uarm->spe--; - } - break; - case 'S': - if(ctmp && !rn2(8)) { - poisoned("snake's bite",mdat->mname); - } - break; - case 's': - if(tmp && !rn2(8)) { - poisoned("scorpion's sting",mdat->mname); - } - (void) hitu(mtmp,rnd(8)); - (void) hitu(mtmp,rnd(8)); - break; - case 'T': - (void) hitu(mtmp,rnd(6)); - (void) hitu(mtmp,rnd(6)); - break; - case 't': - if(!rn2(5)) rloc(mtmp); - break; - case 'u': - mtmp->mflee = 1; - break; - case 'U': - (void) hitu(mtmp,d(3,4)); - (void) hitu(mtmp,d(3,4)); - break; - case 'v': - if(ctmp && !u.ustuck) u.ustuck = mtmp; - break; - case 'V': - if(tmp) u.uhp -= 4; - if(ctmp) losexp(); - break; - case 'W': - if(ctmp) losexp(); - break; -#ifndef NOWORM - case 'w': - if(tmp) wormhit(mtmp); -#endif NOWORM - break; - case 'X': - (void) hitu(mtmp,rnd(5)); - (void) hitu(mtmp,rnd(5)); - (void) hitu(mtmp,rnd(5)); - break; - case 'x': - { register long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE; - pline("%s pricks in your %s leg!", - Monnam(mtmp), (side == RIGHT_SIDE) ? "right" : "left"); - set_wounded_legs(side, rnd(50)); - losehp_m(2, mtmp); - break; - } - case 'y': - if(mtmp->mcan) break; - mondead(mtmp); - if(!Blind) { - pline("You are blinded by a blast of light!"); - Blind = d(4,12); - seeoff(0); - } - return(1); - case 'Y': - (void) hitu(mtmp,rnd(6)); - break; - } - if(u.uhp < 1) done_in_by(mtmp); - return(0); -} - -hitu(mtmp,dam) -register struct monst *mtmp; -register dam; -{ - register tmp, res; - - nomul(0); - if(u.uswallow) return(0); - - if(mtmp->mhide && mtmp->mundetected) { - mtmp->mundetected = 0; - if(!Blind) { - register struct obj *obj; - extern char * Xmonnam(); - if(obj = o_at(mtmp->mx,mtmp->my)) - pline("%s was hidden under %s!", - Xmonnam(mtmp), doname(obj)); - } - } - - tmp = u.uac; - /* give people with Ac = -10 at least some vulnerability */ - if(tmp < 0) { - dam += tmp; /* decrease damage */ - if(dam <= 0) dam = 1; - tmp = -rn2(-tmp); - } - tmp += mtmp->data->mlevel; - if(multi < 0) tmp += 4; - if((Invis && mtmp->data->mlet != 'I') || !mtmp->mcansee) tmp -= 2; - if(mtmp->mtrapped) tmp -= 2; - if(tmp <= rnd(20)) { - if(Blind) pline("It misses."); - else pline("%s misses.",Monnam(mtmp)); - res = 0; - } else { - if(Blind) pline("It hits!"); - else pline("%s hits!",Monnam(mtmp)); - losehp_m(dam, mtmp); - res = 1; - } - stop_occupation(); - return(res); -} diff --git a/games/hack/hack.mklev.c b/games/hack/hack.mklev.c deleted file mode 100644 index 89040213744d..000000000000 --- a/games/hack/hack.mklev.c +++ /dev/null @@ -1,741 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mklev.c - version 1.0.3 */ - -#include "hack.h" - -extern char *getlogin(), *getenv(); -extern struct monst *makemon(); -extern struct obj *mkobj_at(); -extern struct trap *maketrap(); - -#define somex() ((random()%(croom->hx-croom->lx+1))+croom->lx) -#define somey() ((random()%(croom->hy-croom->ly+1))+croom->ly) - -#include "def.mkroom.h" -#define XLIM 4 /* define minimum required space around a room */ -#define YLIM 3 -boolean secret; /* TRUE while making a vault: increase [XY]LIM */ -struct mkroom rooms[MAXNROFROOMS+1]; -int smeq[MAXNROFROOMS+1]; -coord doors[DOORMAX]; -int doorindex; -struct rm zerorm; -int comp(); -schar nxcor; -boolean goldseen; -int nroom; -xchar xdnstair,xupstair,ydnstair,yupstair; - -/* Definitions used by makerooms() and addrs() */ -#define MAXRS 50 /* max lth of temp rectangle table - arbitrary */ -struct rectangle { - xchar rlx,rly,rhx,rhy; -} rs[MAXRS+1]; -int rscnt,rsmax; /* 0..rscnt-1: currently under consideration */ - /* rscnt..rsmax: discarded */ - -makelevel() -{ - register struct mkroom *croom, *troom; - register unsigned tryct; - register x,y; - - nroom = 0; - doorindex = 0; - rooms[0].hx = -1; /* in case we are in a maze */ - - for(x=0; x= rn1(3, 26)) { /* there might be several mazes */ - makemaz(); - return; - } - - /* construct the rooms */ - nroom = 0; - secret = FALSE; - (void) makerooms(); - - /* construct stairs (up and down in different rooms if possible) */ - croom = &rooms[rn2(nroom)]; - xdnstair = somex(); - ydnstair = somey(); - levl[xdnstair][ydnstair].scrsym ='>'; - levl[xdnstair][ydnstair].typ = STAIRS; - if(nroom > 1) { - troom = croom; - croom = &rooms[rn2(nroom-1)]; - if(croom >= troom) croom++; - } - xupstair = somex(); /* %% < and > might be in the same place */ - yupstair = somey(); - levl[xupstair][yupstair].scrsym ='<'; - levl[xupstair][yupstair].typ = STAIRS; - - /* for each room: put things inside */ - for(croom = rooms; croom->hx > 0; croom++) { - - /* put a sleeping monster inside */ - /* Note: monster may be on the stairs. This cannot be - avoided: maybe the player fell through a trapdoor - while a monster was on the stairs. Conclusion: - we have to check for monsters on the stairs anyway. */ - if(!rn2(3)) (void) - makemon((struct permonst *) 0, somex(), somey()); - - /* put traps and mimics inside */ - goldseen = FALSE; - while(!rn2(8-(dlevel/6))) mktrap(0,0,croom); - if(!goldseen && !rn2(3)) mkgold(0L,somex(),somey()); - if(!rn2(3)) { - (void) mkobj_at(0, somex(), somey()); - tryct = 0; - while(!rn2(5)) { - if(++tryct > 100){ - printf("tryct overflow4\n"); - break; - } - (void) mkobj_at(0, somex(), somey()); - } - } - } - - qsort((char *) rooms, nroom, sizeof(struct mkroom), comp); - makecorridors(); - make_niches(); - - /* make a secret treasure vault, not connected to the rest */ - if(nroom <= (2*MAXNROFROOMS/3)) if(rn2(3)) { - troom = &rooms[nroom]; - secret = TRUE; - if(makerooms()) { - troom->rtype = VAULT; /* treasure vault */ - for(x = troom->lx; x <= troom->hx; x++) - for(y = troom->ly; y <= troom->hy; y++) - mkgold((long)(rnd(dlevel*100) + 50), x, y); - if(!rn2(3)) - makevtele(); - } - } - -#ifndef QUEST -#ifdef WIZARD - if(wizard && getenv("SHOPTYPE")) mkshop(); else -#endif WIZARD - if(dlevel > 1 && dlevel < 20 && rn2(dlevel) < 3) mkshop(); - else - if(dlevel > 6 && !rn2(7)) mkzoo(ZOO); - else - if(dlevel > 9 && !rn2(5)) mkzoo(BEEHIVE); - else - if(dlevel > 11 && !rn2(6)) mkzoo(MORGUE); - else - if(dlevel > 18 && !rn2(6)) mkswamp(); -#endif QUEST -} - -makerooms() { -register struct rectangle *rsp; -register int lx, ly, hx, hy, lowx, lowy, hix, hiy, dx, dy; -int tryct = 0, xlim, ylim; - - /* init */ - xlim = XLIM + secret; - ylim = YLIM + secret; - if(nroom == 0) { - rsp = rs; - rsp->rlx = rsp->rly = 0; - rsp->rhx = COLNO-1; - rsp->rhy = ROWNO-1; - rsmax = 1; - } - rscnt = rsmax; - - /* make rooms until satisfied */ - while(rscnt > 0 && nroom < MAXNROFROOMS-1) { - if(!secret && nroom > (MAXNROFROOMS/3) && - !rn2((MAXNROFROOMS-nroom)*(MAXNROFROOMS-nroom))) - return(0); - - /* pick a rectangle */ - rsp = &rs[rn2(rscnt)]; - hx = rsp->rhx; - hy = rsp->rhy; - lx = rsp->rlx; - ly = rsp->rly; - - /* find size of room */ - if(secret) - dx = dy = 1; - else { - dx = 2 + rn2((hx-lx-8 > 20) ? 12 : 8); - dy = 2 + rn2(4); - if(dx*dy > 50) - dy = 50/dx; - } - - /* look whether our room will fit */ - if(hx-lx < dx + dx/2 + 2*xlim || hy-ly < dy + dy/3 + 2*ylim) { - /* no, too small */ - /* maybe we throw this area out */ - if(secret || !rn2(MAXNROFROOMS+1-nroom-tryct)) { - rscnt--; - rs[rsmax] = *rsp; - *rsp = rs[rscnt]; - rs[rscnt] = rs[rsmax]; - tryct = 0; - } else - tryct++; - continue; - } - - lowx = lx + xlim + rn2(hx - lx - dx - 2*xlim + 1); - lowy = ly + ylim + rn2(hy - ly - dy - 2*ylim + 1); - hix = lowx + dx; - hiy = lowy + dy; - - if(maker(lowx, dx, lowy, dy)) { - if(secret) - return(1); - addrs(lowx-1, lowy-1, hix+1, hiy+1); - tryct = 0; - } else - if(tryct++ > 100) - break; - } - return(0); /* failed to make vault - very strange */ -} - -addrs(lowx,lowy,hix,hiy) -register int lowx,lowy,hix,hiy; -{ - register struct rectangle *rsp; - register int lx,ly,hx,hy,xlim,ylim; - boolean discarded; - - xlim = XLIM + secret; - ylim = YLIM + secret; - - /* walk down since rscnt and rsmax change */ - for(rsp = &rs[rsmax-1]; rsp >= rs; rsp--) { - - if((lx = rsp->rlx) > hix || (ly = rsp->rly) > hiy || - (hx = rsp->rhx) < lowx || (hy = rsp->rhy) < lowy) - continue; - if((discarded = (rsp >= &rs[rscnt]))) { - *rsp = rs[--rsmax]; - } else { - rsmax--; - rscnt--; - *rsp = rs[rscnt]; - if(rscnt != rsmax) - rs[rscnt] = rs[rsmax]; - } - if(lowy - ly > 2*ylim + 4) - addrsx(lx,ly,hx,lowy-2,discarded); - if(lowx - lx > 2*xlim + 4) - addrsx(lx,ly,lowx-2,hy,discarded); - if(hy - hiy > 2*ylim + 4) - addrsx(lx,hiy+2,hx,hy,discarded); - if(hx - hix > 2*xlim + 4) - addrsx(hix+2,ly,hx,hy,discarded); - } -} - -addrsx(lx,ly,hx,hy,discarded) -register int lx,ly,hx,hy; -boolean discarded; /* piece of a discarded area */ -{ - register struct rectangle *rsp; - - /* check inclusions */ - for(rsp = rs; rsp < &rs[rsmax]; rsp++) { - if(lx >= rsp->rlx && hx <= rsp->rhx && - ly >= rsp->rly && hy <= rsp->rhy) - return; - } - - /* make a new entry */ - if(rsmax >= MAXRS) { -#ifdef WIZARD - if(wizard) pline("MAXRS may be too small."); -#endif WIZARD - return; - } - rsmax++; - if(!discarded) { - *rsp = rs[rscnt]; - rsp = &rs[rscnt]; - rscnt++; - } - rsp->rlx = lx; - rsp->rly = ly; - rsp->rhx = hx; - rsp->rhy = hy; -} - -comp(x,y) -register struct mkroom *x,*y; -{ - if(x->lx < y->lx) return(-1); - return(x->lx > y->lx); -} - -coord -finddpos(xl,yl,xh,yh) { - coord ff; - register x,y; - - x = (xl == xh) ? xl : (xl + rn2(xh-xl+1)); - y = (yl == yh) ? yl : (yl + rn2(yh-yl+1)); - if(okdoor(x, y)) - goto gotit; - - for(x = xl; x <= xh; x++) for(y = yl; y <= yh; y++) - if(okdoor(x, y)) - goto gotit; - - for(x = xl; x <= xh; x++) for(y = yl; y <= yh; y++) - if(levl[x][y].typ == DOOR || levl[x][y].typ == SDOOR) - goto gotit; - /* cannot find something reasonable -- strange */ - x = xl; - y = yh; -gotit: - ff.x = x; - ff.y = y; - return(ff); -} - -/* see whether it is allowable to create a door at [x,y] */ -okdoor(x,y) -register x,y; -{ - if(levl[x-1][y].typ == DOOR || levl[x+1][y].typ == DOOR || - levl[x][y+1].typ == DOOR || levl[x][y-1].typ == DOOR || - levl[x-1][y].typ == SDOOR || levl[x+1][y].typ == SDOOR || - levl[x][y-1].typ == SDOOR || levl[x][y+1].typ == SDOOR || - (levl[x][y].typ != HWALL && levl[x][y].typ != VWALL) || - doorindex >= DOORMAX) - return(0); - return(1); -} - -dodoor(x,y,aroom) -register x,y; -register struct mkroom *aroom; -{ - if(doorindex >= DOORMAX) { - impossible("DOORMAX exceeded?"); - return; - } - if(!okdoor(x,y) && nxcor) - return; - dosdoor(x,y,aroom,rn2(8) ? DOOR : SDOOR); -} - -dosdoor(x,y,aroom,type) -register x,y; -register struct mkroom *aroom; -register type; -{ - register struct mkroom *broom; - register tmp; - - if(!IS_WALL(levl[x][y].typ)) /* avoid SDOORs with '+' as scrsym */ - type = DOOR; - levl[x][y].typ = type; - if(type == DOOR) - levl[x][y].scrsym = '+'; - aroom->doorct++; - broom = aroom+1; - if(broom->hx < 0) tmp = doorindex; else - for(tmp = doorindex; tmp > broom->fdoor; tmp--) - doors[tmp] = doors[tmp-1]; - doorindex++; - doors[tmp].x = x; - doors[tmp].y = y; - for( ; broom->hx >= 0; broom++) broom->fdoor++; -} - -/* Only called from makerooms() */ -maker(lowx,ddx,lowy,ddy) -schar lowx,ddx,lowy,ddy; -{ - register struct mkroom *croom; - register x, y, hix = lowx+ddx, hiy = lowy+ddy; - register xlim = XLIM + secret, ylim = YLIM + secret; - - if(nroom >= MAXNROFROOMS) return(0); - if(lowx < XLIM) lowx = XLIM; - if(lowy < YLIM) lowy = YLIM; - if(hix > COLNO-XLIM-1) hix = COLNO-XLIM-1; - if(hiy > ROWNO-YLIM-1) hiy = ROWNO-YLIM-1; -chk: - if(hix <= lowx || hiy <= lowy) return(0); - - /* check area around room (and make room smaller if necessary) */ - for(x = lowx - xlim; x <= hix + xlim; x++) { - for(y = lowy - ylim; y <= hiy + ylim; y++) { - if(levl[x][y].typ) { -#ifdef WIZARD - if(wizard && !secret) - pline("Strange area [%d,%d] in maker().",x,y); -#endif WIZARD - if(!rn2(3)) return(0); - if(x < lowx) - lowx = x+xlim+1; - else - hix = x-xlim-1; - if(y < lowy) - lowy = y+ylim+1; - else - hiy = y-ylim-1; - goto chk; - } - } - } - - croom = &rooms[nroom]; - - /* on low levels the room is lit (usually) */ - /* secret vaults are always lit */ - if((rnd(dlevel) < 10 && rn2(77)) || (ddx == 1 && ddy == 1)) { - for(x = lowx-1; x <= hix+1; x++) - for(y = lowy-1; y <= hiy+1; y++) - levl[x][y].lit = 1; - croom->rlit = 1; - } else - croom->rlit = 0; - croom->lx = lowx; - croom->hx = hix; - croom->ly = lowy; - croom->hy = hiy; - croom->rtype = croom->doorct = croom->fdoor = 0; - - for(x = lowx-1; x <= hix+1; x++) - for(y = lowy-1; y <= hiy+1; y += (hiy-lowy+2)) { - levl[x][y].scrsym = '-'; - levl[x][y].typ = HWALL; - } - for(x = lowx-1; x <= hix+1; x += (hix-lowx+2)) - for(y = lowy; y <= hiy; y++) { - levl[x][y].scrsym = '|'; - levl[x][y].typ = VWALL; - } - for(x = lowx; x <= hix; x++) - for(y = lowy; y <= hiy; y++) { - levl[x][y].scrsym = '.'; - levl[x][y].typ = ROOM; - } - - smeq[nroom] = nroom; - croom++; - croom->hx = -1; - nroom++; - return(1); -} - -makecorridors() { - register a,b; - - nxcor = 0; - for(a = 0; a < nroom-1; a++) - join(a, a+1); - for(a = 0; a < nroom-2; a++) - if(smeq[a] != smeq[a+2]) - join(a, a+2); - for(a = 0; a < nroom; a++) - for(b = 0; b < nroom; b++) - if(smeq[a] != smeq[b]) - join(a, b); - if(nroom > 2) - for(nxcor = rn2(nroom) + 4; nxcor; nxcor--) { - a = rn2(nroom); - b = rn2(nroom-2); - if(b >= a) b += 2; - join(a, b); - } -} - -join(a,b) -register a,b; -{ - coord cc,tt; - register tx, ty, xx, yy; - register struct rm *crm; - register struct mkroom *croom, *troom; - register dx, dy, dix, diy, cct; - - croom = &rooms[a]; - troom = &rooms[b]; - - /* find positions cc and tt for doors in croom and troom - and direction for a corridor between them */ - - if(troom->hx < 0 || croom->hx < 0 || doorindex >= DOORMAX) return; - if(troom->lx > croom->hx) { - dx = 1; - dy = 0; - xx = croom->hx+1; - tx = troom->lx-1; - cc = finddpos(xx,croom->ly,xx,croom->hy); - tt = finddpos(tx,troom->ly,tx,troom->hy); - } else if(troom->hy < croom->ly) { - dy = -1; - dx = 0; - yy = croom->ly-1; - cc = finddpos(croom->lx,yy,croom->hx,yy); - ty = troom->hy+1; - tt = finddpos(troom->lx,ty,troom->hx,ty); - } else if(troom->hx < croom->lx) { - dx = -1; - dy = 0; - xx = croom->lx-1; - tx = troom->hx+1; - cc = finddpos(xx,croom->ly,xx,croom->hy); - tt = finddpos(tx,troom->ly,tx,troom->hy); - } else { - dy = 1; - dx = 0; - yy = croom->hy+1; - ty = troom->ly-1; - cc = finddpos(croom->lx,yy,croom->hx,yy); - tt = finddpos(troom->lx,ty,troom->hx,ty); - } - xx = cc.x; - yy = cc.y; - tx = tt.x - dx; - ty = tt.y - dy; - if(nxcor && levl[xx+dx][yy+dy].typ) - return; - dodoor(xx,yy,croom); - - cct = 0; - while(xx != tx || yy != ty) { - xx += dx; - yy += dy; - - /* loop: dig corridor at [xx,yy] and find new [xx,yy] */ - if(cct++ > 500 || (nxcor && !rn2(35))) - return; - - if(xx == COLNO-1 || xx == 0 || yy == 0 || yy == ROWNO-1) - return; /* impossible */ - - crm = &levl[xx][yy]; - if(!(crm->typ)) { - if(rn2(100)) { - crm->typ = CORR; - crm->scrsym = CORR_SYM; - if(nxcor && !rn2(50)) - (void) mkobj_at(ROCK_SYM, xx, yy); - } else { - crm->typ = SCORR; - crm->scrsym = ' '; - } - } else - if(crm->typ != CORR && crm->typ != SCORR) { - /* strange ... */ - return; - } - - /* find next corridor position */ - dix = abs(xx-tx); - diy = abs(yy-ty); - - /* do we have to change direction ? */ - if(dy && dix > diy) { - register ddx = (xx > tx) ? -1 : 1; - - crm = &levl[xx+ddx][yy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) { - dx = ddx; - dy = 0; - continue; - } - } else if(dx && diy > dix) { - register ddy = (yy > ty) ? -1 : 1; - - crm = &levl[xx][yy+ddy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) { - dy = ddy; - dx = 0; - continue; - } - } - - /* continue straight on? */ - crm = &levl[xx+dx][yy+dy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) - continue; - - /* no, what must we do now?? */ - if(dx) { - dx = 0; - dy = (ty < yy) ? -1 : 1; - crm = &levl[xx+dx][yy+dy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) - continue; - dy = -dy; - continue; - } else { - dy = 0; - dx = (tx < xx) ? -1 : 1; - crm = &levl[xx+dx][yy+dy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) - continue; - dx = -dx; - continue; - } - } - - /* we succeeded in digging the corridor */ - dodoor(tt.x, tt.y, troom); - - if(smeq[a] < smeq[b]) - smeq[b] = smeq[a]; - else - smeq[a] = smeq[b]; -} - -make_niches() -{ - register int ct = rnd(nroom/2 + 1); - while(ct--) makeniche(FALSE); -} - -makevtele() -{ - makeniche(TRUE); -} - -makeniche(with_trap) -boolean with_trap; -{ - register struct mkroom *aroom; - register struct rm *rm; - register int vct = 8; - coord dd; - register dy,xx,yy; - register struct trap *ttmp; - - if(doorindex < DOORMAX) - while(vct--) { - aroom = &rooms[rn2(nroom-1)]; - if(aroom->rtype != 0) continue; /* not an ordinary room */ - if(aroom->doorct == 1 && rn2(5)) continue; - if(rn2(2)) { - dy = 1; - dd = finddpos(aroom->lx,aroom->hy+1,aroom->hx,aroom->hy+1); - } else { - dy = -1; - dd = finddpos(aroom->lx,aroom->ly-1,aroom->hx,aroom->ly-1); - } - xx = dd.x; - yy = dd.y; - if((rm = &levl[xx][yy+dy])->typ) continue; - if(with_trap || !rn2(4)) { - rm->typ = SCORR; - rm->scrsym = ' '; - if(with_trap) { - ttmp = maketrap(xx, yy+dy, TELEP_TRAP); - ttmp->once = 1; - make_engr_at(xx, yy-dy, "ad ae?ar um"); - } - dosdoor(xx, yy, aroom, SDOOR); - } else { - rm->typ = CORR; - rm->scrsym = CORR_SYM; - if(rn2(7)) - dosdoor(xx, yy, aroom, rn2(5) ? SDOOR : DOOR); - else { - mksobj_at(SCR_TELEPORTATION, xx, yy+dy); - if(!rn2(3)) (void) mkobj_at(0, xx, yy+dy); - } - } - return; - } -} - -/* make a trap somewhere (in croom if mazeflag = 0) */ -mktrap(num,mazeflag,croom) -register num,mazeflag; -register struct mkroom *croom; -{ - register struct trap *ttmp; - register int kind,nopierc,nomimic,fakedoor,fakegold,tryct = 0; - register xchar mx,my; - extern char fut_geno[]; - - if(!num || num >= TRAPNUM) { - nopierc = (dlevel < 4) ? 1 : 0; - nomimic = (dlevel < 9 || goldseen ) ? 1 : 0; - if(index(fut_geno, 'M')) nomimic = 1; - kind = rn2(TRAPNUM - nopierc - nomimic); - /* note: PIERC = 7, MIMIC = 8, TRAPNUM = 9 */ - } else kind = num; - - if(kind == MIMIC) { - register struct monst *mtmp; - - fakedoor = (!rn2(3) && !mazeflag); - fakegold = (!fakedoor && !rn2(2)); - if(fakegold) goldseen = TRUE; - do { - if(++tryct > 200) return; - if(fakedoor) { - /* note: fakedoor maybe on actual door */ - if(rn2(2)){ - if(rn2(2)) - mx = croom->hx+1; - else mx = croom->lx-1; - my = somey(); - } else { - if(rn2(2)) - my = croom->hy+1; - else my = croom->ly-1; - mx = somex(); - } - } else if(mazeflag) { - extern coord mazexy(); - coord mm; - mm = mazexy(); - mx = mm.x; - my = mm.y; - } else { - mx = somex(); - my = somey(); - } - } while(m_at(mx,my) || levl[mx][my].typ == STAIRS); - if(mtmp = makemon(PM_MIMIC,mx,my)) { - mtmp->mimic = 1; - mtmp->mappearance = - fakegold ? '$' : fakedoor ? '+' : - (mazeflag && rn2(2)) ? AMULET_SYM : - "=/)%?![<>" [ rn2(9) ]; - } - return; - } - - do { - if(++tryct > 200) - return; - if(mazeflag){ - extern coord mazexy(); - coord mm; - mm = mazexy(); - mx = mm.x; - my = mm.y; - } else { - mx = somex(); - my = somey(); - } - } while(t_at(mx, my) || levl[mx][my].typ == STAIRS); - ttmp = maketrap(mx, my, kind); - if(mazeflag && !rn2(10) && ttmp->ttyp < PIERC) - ttmp->tseen = 1; -} diff --git a/games/hack/hack.mkmaze.c b/games/hack/hack.mkmaze.c deleted file mode 100644 index bee24f954c30..000000000000 --- a/games/hack/hack.mkmaze.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mkmaze.c - version 1.0.2 */ - -#include "hack.h" -#include "def.mkroom.h" /* not really used */ -extern struct monst *makemon(); -extern struct permonst pm_wizard; -extern struct obj *mkobj_at(); -extern coord mazexy(); -struct permonst hell_hound = - { "hell hound", 'd', 12, 14, 2, 3, 6, 0 }; - -makemaz() -{ - int x,y; - register zx,zy; - coord mm; - boolean al = (dlevel >= 30 && !flags.made_amulet); - - for(x = 2; x < COLNO-1; x++) - for(y = 2; y < ROWNO-1; y++) - levl[x][y].typ = (x%2 && y%2) ? 0 : HWALL; - if(al) { - register struct monst *mtmp; - - zx = 2*(COLNO/4) - 1; - zy = 2*(ROWNO/4) - 1; - for(x = zx-2; x < zx+4; x++) for(y = zy-2; y <= zy+2; y++) { - levl[x][y].typ = - (y == zy-2 || y == zy+2 || x == zx-2 || x == zx+3) ? POOL : - (y == zy-1 || y == zy+1 || x == zx-1 || x == zx+2) ? HWALL: - ROOM; - } - (void) mkobj_at(AMULET_SYM, zx, zy); - flags.made_amulet = 1; - walkfrom(zx+4, zy); - if(mtmp = makemon(&hell_hound, zx, zy)) - mtmp->msleep = 1; - if(mtmp = makemon(PM_WIZARD, zx+1, zy)) { - mtmp->msleep = 1; - flags.no_of_wizards = 1; - } - } else { - mm = mazexy(); - zx = mm.x; - zy = mm.y; - walkfrom(zx,zy); - (void) mksobj_at(WAN_WISHING, zx, zy); - (void) mkobj_at(ROCK_SYM, zx, zy); /* put a rock on top of it */ - } - - for(x = 2; x < COLNO-1; x++) - for(y = 2; y < ROWNO-1; y++) { - switch(levl[x][y].typ) { - case HWALL: - levl[x][y].scrsym = '-'; - break; - case ROOM: - levl[x][y].scrsym = '.'; - break; - } - } - for(x = rn1(8,11); x; x--) { - mm = mazexy(); - (void) mkobj_at(rn2(2) ? GEM_SYM : 0, mm.x, mm.y); - } - for(x = rn1(10,2); x; x--) { - mm = mazexy(); - (void) mkobj_at(ROCK_SYM, mm.x, mm.y); - } - mm = mazexy(); - (void) makemon(PM_MINOTAUR, mm.x, mm.y); - for(x = rn1(5,7); x; x--) { - mm = mazexy(); - (void) makemon((struct permonst *) 0, mm.x, mm.y); - } - for(x = rn1(6,7); x; x--) { - mm = mazexy(); - mkgold(0L,mm.x,mm.y); - } - for(x = rn1(6,7); x; x--) - mktrap(0,1,(struct mkroom *) 0); - mm = mazexy(); - levl[(xupstair = mm.x)][(yupstair = mm.y)].scrsym = '<'; - levl[xupstair][yupstair].typ = STAIRS; - xdnstair = ydnstair = 0; -} - -walkfrom(x,y) int x,y; { -register int q,a,dir; -int dirs[4]; - levl[x][y].typ = ROOM; - while(1) { - q = 0; - for(a = 0; a < 4; a++) - if(okay(x,y,a)) dirs[q++]= a; - if(!q) return; - dir = dirs[rn2(q)]; - move(&x,&y,dir); - levl[x][y].typ = ROOM; - move(&x,&y,dir); - walkfrom(x,y); - } -} - -move(x,y,dir) -register int *x, *y; -register int dir; -{ - switch(dir){ - case 0: --(*y); break; - case 1: (*x)++; break; - case 2: (*y)++; break; - case 3: --(*x); break; - } -} - -okay(x,y,dir) -int x,y; -register int dir; -{ - move(&x,&y,dir); - move(&x,&y,dir); - if(x<3 || y<3 || x>COLNO-3 || y>ROWNO-3 || levl[x][y].typ != 0) - return(0); - else - return(1); -} - -coord -mazexy(){ - coord mm; - mm.x = 3 + 2*rn2(COLNO/2 - 2); - mm.y = 3 + 2*rn2(ROWNO/2 - 2); - return mm; -} diff --git a/games/hack/hack.mkobj.c b/games/hack/hack.mkobj.c deleted file mode 100644 index 18a69146d045..000000000000 --- a/games/hack/hack.mkobj.c +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mkobj.c - version 1.0.3 */ - -#include "hack.h" - -char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%"; -struct obj *mkobj(), *mksobj(); - -struct obj * -mkobj_at(let,x,y) -register let,x,y; -{ - register struct obj *otmp = mkobj(let); - otmp->ox = x; - otmp->oy = y; - otmp->nobj = fobj; - fobj = otmp; - return(otmp); -} - -mksobj_at(otyp,x,y) -register otyp,x,y; -{ - register struct obj *otmp = mksobj(otyp); - otmp->ox = x; - otmp->oy = y; - otmp->nobj = fobj; - fobj = otmp; -} - -struct obj * -mkobj(let) { - if(!let) - let = mkobjstr[rn2(sizeof(mkobjstr) - 1)]; - return( - mksobj( - letter(let) ? - CORPSE + ((let > 'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')) - : probtype(let) - ) - ); -} - - -struct obj zeroobj; - -struct obj * -mksobj(otyp) -register otyp; -{ - register struct obj *otmp; - char let = objects[otyp].oc_olet; - - otmp = newobj(0); - *otmp = zeroobj; - otmp->age = moves; - otmp->o_id = flags.ident++; - otmp->quan = 1; - otmp->olet = let; - otmp->otyp = otyp; - otmp->dknown = index("/=!?*", let) ? 0 : 1; - switch(let) { - case WEAPON_SYM: - otmp->quan = (otmp->otyp <= ROCK) ? rn1(6,6) : 1; - if(!rn2(11)) otmp->spe = rnd(3); - else if(!rn2(10)) { - otmp->cursed = 1; - otmp->spe = -rnd(3); - } - break; - case FOOD_SYM: - if(otmp->otyp >= CORPSE) break; -#ifdef NOT_YET_IMPLEMENTED - /* if tins are to be identified, need to adapt doname() etc */ - if(otmp->otyp == TIN) - otmp->spe = rnd(...); -#endif NOT_YET_IMPLEMENTED - /* fall into next case */ - case GEM_SYM: - otmp->quan = rn2(6) ? 1 : 2; - case TOOL_SYM: - case CHAIN_SYM: - case BALL_SYM: - case ROCK_SYM: - case POTION_SYM: - case SCROLL_SYM: - case AMULET_SYM: - break; - case ARMOR_SYM: - if(!rn2(8)) otmp->cursed = 1; - if(!rn2(10)) otmp->spe = rnd(3); - else if(!rn2(9)) { - otmp->spe = -rnd(3); - otmp->cursed = 1; - } - break; - case WAND_SYM: - if(otmp->otyp == WAN_WISHING) otmp->spe = 3; else - otmp->spe = rn1(5, - (objects[otmp->otyp].bits & NODIR) ? 11 : 4); - break; - case RING_SYM: - if(objects[otmp->otyp].bits & SPEC) { - if(!rn2(3)) { - otmp->cursed = 1; - otmp->spe = -rnd(2); - } else otmp->spe = rnd(2); - } else if(otmp->otyp == RIN_TELEPORTATION || - otmp->otyp == RIN_AGGRAVATE_MONSTER || - otmp->otyp == RIN_HUNGER || !rn2(9)) - otmp->cursed = 1; - break; - default: - panic("impossible mkobj"); - } - otmp->owt = weight(otmp); - return(otmp); -} - -letter(c) { - return(('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z')); -} - -weight(obj) -register struct obj *obj; -{ -register int wt = objects[obj->otyp].oc_weight; - return(wt ? wt*obj->quan : (obj->quan + 1)/2); -} - -mkgold(num,x,y) -register long num; -{ - register struct gold *gold; - register long amount = (num ? num : 1 + (rnd(dlevel+2) * rnd(30))); - - if(gold = g_at(x,y)) - gold->amount += amount; - else { - gold = newgold(); - gold->ngold = fgold; - gold->gx = x; - gold->gy = y; - gold->amount = amount; - fgold = gold; - /* do sth with display? */ - } -} diff --git a/games/hack/hack.mkshop.c b/games/hack/hack.mkshop.c deleted file mode 100644 index 7a8fdfbfaaa6..000000000000 --- a/games/hack/hack.mkshop.c +++ /dev/null @@ -1,274 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mkshop.c - version 1.0.3 */ - -#ifndef QUEST -#include "hack.h" -#include "def.mkroom.h" -#include "def.eshk.h" -#define ESHK ((struct eshk *)(&(shk->mextra[0]))) -extern struct monst *makemon(); -extern struct obj *mkobj_at(); -extern int nroom; -extern char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */ -schar shprobs[] = { 3,3,5,5,10,10,14,50 }; /* their probabilities */ - -mkshop(){ -register struct mkroom *sroom; -register int sh,sx,sy,i = -1; -register char let; -int roomno; -register struct monst *shk; -#ifdef WIZARD -extern char *getenv(); -register char *ep = getenv("SHOPTYPE"); - /* first determine shoptype */ - if(wizard){ - if(ep){ - if(*ep == 'z' || *ep == 'Z'){ - mkzoo(ZOO); - return; - } - if(*ep == 'm' || *ep == 'M'){ - mkzoo(MORGUE); - return; - } - if(*ep == 'b' || *ep == 'B'){ - mkzoo(BEEHIVE); - return; - } - if(*ep == 's' || *ep == 'S'){ - mkswamp(); - return; - } - for(i=0; shtypes[i]; i++) - if(*ep == shtypes[i]) break; - goto gottype; - } - } -gottype: -#endif WIZARD - for(sroom = &rooms[0], roomno = 0; ; sroom++, roomno++){ - if(sroom->hx < 0) return; - if(sroom - rooms >= nroom) { - pline("rooms not closed by -1?"); - return; - } - if(sroom->rtype) continue; - if(!sroom->rlit || has_dnstairs(sroom) || has_upstairs(sroom)) - continue; - if( -#ifdef WIZARD - (wizard && ep != NULL && sroom->doorct != 0) || -#endif WIZARD - sroom->doorct <= 2 && sroom->doorct > 0) break; - } - - if(i < 0) { /* shoptype not yet determined */ - register int j; - - for(j = rn2(100), i = 0; (j -= shprobs[i])>= 0; i++) - if(!shtypes[i]) break; /* superfluous */ - if(isbig(sroom) && i + SHOPBASE == WANDSHOP) - i = GENERAL-SHOPBASE; - } - sroom->rtype = i + SHOPBASE; - let = shtypes[i]; - sh = sroom->fdoor; - sx = doors[sh].x; - sy = doors[sh].y; - if(sx == sroom->lx-1) sx++; else - if(sx == sroom->hx+1) sx--; else - if(sy == sroom->ly-1) sy++; else - if(sy == sroom->hy+1) sy--; else { -#ifdef WIZARD - /* This is said to happen sometimes, but I've never seen it. */ - if(wizard) { - register int j = sroom->doorct; - extern int doorindex; - - pline("Where is shopdoor?"); - pline("Room at (%d,%d),(%d,%d).", sroom->lx, sroom->ly, - sroom->hx, sroom->hy); - pline("doormax=%d doorct=%d fdoor=%d", - doorindex, sroom->doorct, sh); - while(j--) { - pline("door [%d,%d]", doors[sh].x, doors[sh].y); - sh++; - } - more(); - } -#endif WIZARD - return; - } - if(!(shk = makemon(PM_SHK,sx,sy))) return; - shk->isshk = shk->mpeaceful = 1; - shk->msleep = 0; - shk->mtrapseen = ~0; /* we know all the traps already */ - ESHK->shoproom = roomno; - ESHK->shoplevel = dlevel; - ESHK->shd = doors[sh]; - ESHK->shk.x = sx; - ESHK->shk.y = sy; - ESHK->robbed = 0; - ESHK->visitct = 0; - ESHK->following = 0; - shk->mgold = 1000 + 30*rnd(100); /* initial capital */ - ESHK->billct = 0; - findname(ESHK->shknam, let); - for(sx = sroom->lx; sx <= sroom->hx; sx++) - for(sy = sroom->ly; sy <= sroom->hy; sy++){ - register struct monst *mtmp; - if((sx == sroom->lx && doors[sh].x == sx-1) || - (sx == sroom->hx && doors[sh].x == sx+1) || - (sy == sroom->ly && doors[sh].y == sy-1) || - (sy == sroom->hy && doors[sh].y == sy+1)) continue; - if(rn2(100) < dlevel && !m_at(sx,sy) && - (mtmp = makemon(PM_MIMIC, sx, sy))){ - mtmp->mimic = 1; - mtmp->mappearance = - (let && rn2(10) < dlevel) ? let : ']'; - continue; - } - (void) mkobj_at(let, sx, sy); - } -} - -mkzoo(type) -int type; -{ - register struct mkroom *sroom; - register struct monst *mon; - register int sh,sx,sy,i; - int goldlim = 500 * dlevel; - int moct = 0; - struct permonst *morguemon(); - - i = nroom; - for(sroom = &rooms[rn2(nroom)]; ; sroom++) { - if(sroom == &rooms[nroom]) - sroom = &rooms[0]; - if(!i-- || sroom->hx < 0) - return; - if(sroom->rtype) - continue; - if(type == MORGUE && sroom->rlit) - continue; - if(has_upstairs(sroom) || (has_dnstairs(sroom) && rn2(3))) - continue; - if(sroom->doorct == 1 || !rn2(5)) - break; - } - sroom->rtype = type; - sh = sroom->fdoor; - for(sx = sroom->lx; sx <= sroom->hx; sx++) - for(sy = sroom->ly; sy <= sroom->hy; sy++){ - if((sx == sroom->lx && doors[sh].x == sx-1) || - (sx == sroom->hx && doors[sh].x == sx+1) || - (sy == sroom->ly && doors[sh].y == sy-1) || - (sy == sroom->hy && doors[sh].y == sy+1)) continue; - mon = makemon( - (type == MORGUE) ? morguemon() : - (type == BEEHIVE) ? PM_KILLER_BEE : (struct permonst *) 0, - sx, sy); - if(mon) mon->msleep = 1; - switch(type) { - case ZOO: - i = sq(dist2(sx,sy,doors[sh].x,doors[sh].y)); - if(i >= goldlim) i = 5*dlevel; - goldlim -= i; - mkgold((long)(10 + rn2(i)), sx, sy); - break; - case MORGUE: - /* Usually there is one dead body in the morgue */ - if(!moct && rn2(3)) { - mksobj_at(CORPSE, sx, sy); - moct++; - } - break; - case BEEHIVE: - if(!rn2(3)) mksobj_at(LUMP_OF_ROYAL_JELLY, sx, sy); - break; - } - } -} - -struct permonst * -morguemon() -{ - extern struct permonst pm_ghost; - register int i = rn2(100), hd = rn2(dlevel); - - if(hd > 10 && i < 10) return(PM_DEMON); - if(hd > 8 && i > 85) return(PM_VAMPIRE); - return((i < 40) ? PM_GHOST : (i < 60) ? PM_WRAITH : PM_ZOMBIE); -} - -mkswamp() /* Michiel Huisjes & Fred de Wilde */ -{ - register struct mkroom *sroom; - register int sx,sy,i,eelct = 0; - extern struct permonst pm_eel; - - for(i=0; i<5; i++) { /* 5 tries */ - sroom = &rooms[rn2(nroom)]; - if(sroom->hx < 0 || sroom->rtype || - has_upstairs(sroom) || has_dnstairs(sroom)) - continue; - - /* satisfied; make a swamp */ - sroom->rtype = SWAMP; - for(sx = sroom->lx; sx <= sroom->hx; sx++) - for(sy = sroom->ly; sy <= sroom->hy; sy++) - if((sx+sy)%2 && !o_at(sx,sy) && !t_at(sx,sy) - && !m_at(sx,sy) && !nexttodoor(sx,sy)){ - levl[sx][sy].typ = POOL; - levl[sx][sy].scrsym = POOL_SYM; - if(!eelct || !rn2(4)) { - (void) makemon(PM_EEL, sx, sy); - eelct++; - } - } - } -} - -nexttodoor(sx,sy) -register sx,sy; -{ - register dx,dy; - register struct rm *lev; - for(dx = -1; dx <= 1; dx++) for(dy = -1; dy <= 1; dy++) - if((lev = &levl[sx+dx][sy+dy])->typ == DOOR || - lev->typ == SDOOR || lev->typ == LDOOR) - return(1); - return(0); -} - -has_dnstairs(sroom) -register struct mkroom *sroom; -{ - return(sroom->lx <= xdnstair && xdnstair <= sroom->hx && - sroom->ly <= ydnstair && ydnstair <= sroom->hy); -} - -has_upstairs(sroom) -register struct mkroom *sroom; -{ - return(sroom->lx <= xupstair && xupstair <= sroom->hx && - sroom->ly <= yupstair && yupstair <= sroom->hy); -} - -isbig(sroom) -register struct mkroom *sroom; -{ - register int area = (sroom->hx - sroom->lx) * (sroom->hy - sroom->ly); - return( area > 20 ); -} - -dist2(x0,y0,x1,y1){ - return((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1)); -} - -sq(a) int a; { - return(a*a); -} -#endif QUEST diff --git a/games/hack/hack.mon.c b/games/hack/hack.mon.c deleted file mode 100644 index b31c15922c9a..000000000000 --- a/games/hack/hack.mon.c +++ /dev/null @@ -1,853 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mon.c - version 1.0.3 */ - -#include "hack.h" -#include "hack.mfndpos.h" - -#ifndef NULL -#define NULL (char *) 0 -#endif - -extern struct monst *makemon(); -extern struct obj *mkobj_at(); - -int warnlevel; /* used by movemon and dochugw */ -long lastwarntime; -int lastwarnlev; -char *warnings[] = { - "white", "pink", "red", "ruby", "purple", "black" -}; - -movemon() -{ - register struct monst *mtmp; - register int fr; - - warnlevel = 0; - - while(1) { - /* find a monster that we haven't treated yet */ - /* note that mtmp or mtmp->nmon might get killed - while mtmp moves, so we cannot just walk down the - chain (even new monsters might get created!) */ - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) - if(mtmp->mlstmv < moves) goto next_mon; - /* treated all monsters */ - break; - - next_mon: - mtmp->mlstmv = moves; - - /* most monsters drown in pools */ - { boolean inpool, iseel; - - inpool = (levl[mtmp->mx][mtmp->my].typ == POOL); - iseel = (mtmp->data->mlet == ';'); - if(inpool && !iseel) { - if(cansee(mtmp->mx,mtmp->my)) - pline("%s drowns.", Monnam(mtmp)); - mondead(mtmp); - continue; - } - /* but eels have a difficult time outside */ - if(iseel && !inpool) { - if(mtmp->mhp > 1) mtmp->mhp--; - mtmp->mflee = 1; - mtmp->mfleetim += 2; - } - } - if(mtmp->mblinded && !--mtmp->mblinded) - mtmp->mcansee = 1; - if(mtmp->mfleetim && !--mtmp->mfleetim) - mtmp->mflee = 0; - if(mtmp->mimic) continue; - if(mtmp->mspeed != MSLOW || !(moves%2)){ - /* continue if the monster died fighting */ - fr = -1; - if(Conflict && cansee(mtmp->mx,mtmp->my) - && (fr = fightm(mtmp)) == 2) - continue; - if(fr<0 && dochugw(mtmp)) - continue; - } - if(mtmp->mspeed == MFAST && dochugw(mtmp)) - continue; - } - - warnlevel -= u.ulevel; - if(warnlevel >= SIZE(warnings)) - warnlevel = SIZE(warnings)-1; - if(warnlevel >= 0) - if(warnlevel > lastwarnlev || moves > lastwarntime + 5){ - register char *rr; - switch(Warning & (LEFT_RING | RIGHT_RING)){ - case LEFT_RING: - rr = "Your left ring glows"; - break; - case RIGHT_RING: - rr = "Your right ring glows"; - break; - case LEFT_RING | RIGHT_RING: - rr = "Both your rings glow"; - break; - default: - rr = "Your fingertips glow"; - break; - } - pline("%s %s!", rr, warnings[warnlevel]); - lastwarntime = moves; - lastwarnlev = warnlevel; - } - - dmonsfree(); /* remove all dead monsters */ -} - -justswld(mtmp,name) -register struct monst *mtmp; -char *name; -{ - - mtmp->mx = u.ux; - mtmp->my = u.uy; - u.ustuck = mtmp; - pmon(mtmp); - kludge("%s swallows you!",name); - more(); - seeoff(1); - u.uswallow = 1; - u.uswldtim = 0; - swallowed(); -} - -youswld(mtmp,dam,die,name) -register struct monst *mtmp; -register dam,die; -char *name; -{ - if(mtmp != u.ustuck) return; - kludge("%s digests you!",name); - u.uhp -= dam; - if(u.uswldtim++ >= die){ /* a3 */ - pline("It totally digests you!"); - u.uhp = -1; - } - if(u.uhp < 1) done_in_by(mtmp); - /* flags.botlx = 1; /* should we show status line ? */ -} - -dochugw(mtmp) register struct monst *mtmp; { -register x = mtmp->mx; -register y = mtmp->my; -register d = dochug(mtmp); -register dd; - if(!d) /* monster still alive */ - if(Warning) - if(!mtmp->mpeaceful) - if(mtmp->data->mlevel > warnlevel) - if((dd = dist(mtmp->mx,mtmp->my)) < dist(x,y)) - if(dd < 100) - if(!canseemon(mtmp)) - warnlevel = mtmp->data->mlevel; - return(d); -} - -/* returns 1 if monster died moving, 0 otherwise */ -dochug(mtmp) -register struct monst *mtmp; -{ - register struct permonst *mdat; - register tmp, nearby, scared; - - if(mtmp->cham && !rn2(6)) - (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]); - mdat = mtmp->data; - if(mdat->mlevel < 0) - panic("bad monster %c (%d)",mdat->mlet,mdat->mlevel); - - /* regenerate monsters */ - if((!(moves%20) || index(MREGEN, mdat->mlet)) && - mtmp->mhp < mtmp->mhpmax) - mtmp->mhp++; - - if(mtmp->mfroz) return(0); /* frozen monsters don't do anything */ - - if(mtmp->msleep) { - /* wake up, or get out of here. */ - /* ettins are hard to surprise */ - /* Nymphs and Leprechauns do not easily wake up */ - if(cansee(mtmp->mx,mtmp->my) && - (!Stealth || (mdat->mlet == 'e' && rn2(10))) && - (!index("NL",mdat->mlet) || !rn2(50)) && - (Aggravate_monster || index("d1", mdat->mlet) - || (!rn2(7) && !mtmp->mimic))) - mtmp->msleep = 0; - else return(0); - } - - /* not frozen or sleeping: wipe out texts written in the dust */ - wipe_engr_at(mtmp->mx, mtmp->my, 1); - - /* confused monsters get unconfused with small probability */ - if(mtmp->mconf && !rn2(50)) mtmp->mconf = 0; - - /* some monsters teleport */ - if(mtmp->mflee && index("tNL", mdat->mlet) && !rn2(40)){ - rloc(mtmp); - return(0); - } - if(mdat->mmove < rnd(6)) return(0); - - /* fleeing monsters might regain courage */ - if(mtmp->mflee && !mtmp->mfleetim - && mtmp->mhp == mtmp->mhpmax && !rn2(25)) - mtmp->mflee = 0; - - nearby = (dist(mtmp->mx, mtmp->my) < 3); - scared = (nearby && (sengr_at("Elbereth", u.ux, u.uy) || - sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy))); - if(scared && !mtmp->mflee) { - mtmp->mflee = 1; - mtmp->mfleetim = (rn2(7) ? rnd(10) : rnd(100)); - } - - if(!nearby || - mtmp->mflee || - mtmp->mconf || - (mtmp->minvis && !rn2(3)) || - (index("BIuy", mdat->mlet) && !rn2(4)) || - (mdat->mlet == 'L' && !u.ugold && (mtmp->mgold || rn2(2))) || - (!mtmp->mcansee && !rn2(4)) || - mtmp->mpeaceful - ) { - tmp = m_move(mtmp,0); /* 2: monster died moving */ - if(tmp == 2 || (tmp && mdat->mmove <= 12)) - return(tmp == 2); - } - - if(!index("Ea", mdat->mlet) && nearby && - !mtmp->mpeaceful && u.uhp > 0 && !scared) { - if(mhitu(mtmp)) - return(1); /* monster died (e.g. 'y' or 'F') */ - } - /* extra movement for fast monsters */ - if(mdat->mmove-12 > rnd(12)) tmp = m_move(mtmp,1); - return(tmp == 2); -} - -m_move(mtmp,after) -register struct monst *mtmp; -{ - register struct monst *mtmp2; - register nx,ny,omx,omy,appr,nearer,cnt,i,j; - xchar gx,gy,nix,niy,chcnt; - schar chi; - boolean likegold, likegems, likeobjs; - char msym = mtmp->data->mlet; - schar mmoved = 0; /* not strictly nec.: chi >= 0 will do */ - coord poss[9]; - int info[9]; - - if(mtmp->mfroz || mtmp->msleep) - return(0); - if(mtmp->mtrapped) { - i = mintrap(mtmp); - if(i == 2) return(2); /* he died */ - if(i == 1) return(0); /* still in trap, so didnt move */ - } - if(mtmp->mhide && o_at(mtmp->mx,mtmp->my) && rn2(10)) - return(0); /* do not leave hiding place */ - -#ifndef NOWORM - if(mtmp->wormno) - goto not_special; -#endif NOWORM - - /* my dog gets a special treatment */ - if(mtmp->mtame) { - return( dog_move(mtmp, after) ); - } - - /* likewise for shopkeeper */ - if(mtmp->isshk) { - mmoved = shk_move(mtmp); - if(mmoved >= 0) - goto postmov; - mmoved = 0; /* follow player outside shop */ - } - - /* and for the guard */ - if(mtmp->isgd) { - mmoved = gd_move(); - goto postmov; - } - -/* teleport if that lies in our nature ('t') or when badly wounded ('1') */ - if((msym == 't' && !rn2(5)) - || (msym == '1' && (mtmp->mhp < 7 || (!xdnstair && !rn2(5)) - || levl[u.ux][u.uy].typ == STAIRS))) { - if(mtmp->mhp < 7 || (msym == 't' && rn2(2))) - rloc(mtmp); - else - mnexto(mtmp); - mmoved = 1; - goto postmov; - } - - /* spit fire ('D') or use a wand ('1') when appropriate */ - if(index("D1", msym)) - inrange(mtmp); - - if(msym == 'U' && !mtmp->mcan && canseemon(mtmp) && - mtmp->mcansee && rn2(5)) { - if(!Confusion) - pline("%s's gaze has confused you!", Monnam(mtmp)); - else - pline("You are getting more and more confused."); - if(rn2(3)) mtmp->mcan = 1; - Confusion += d(3,4); /* timeout */ - } -not_special: - if(!mtmp->mflee && u.uswallow && u.ustuck != mtmp) return(1); - appr = 1; - if(mtmp->mflee) appr = -1; - if(mtmp->mconf || Invis || !mtmp->mcansee || - (index("BIy", msym) && !rn2(3))) - appr = 0; - omx = mtmp->mx; - omy = mtmp->my; - gx = u.ux; - gy = u.uy; - if(msym == 'L' && appr == 1 && mtmp->mgold > u.ugold) - appr = -1; - - /* random criterion for 'smell' or track finding ability - should use mtmp->msmell or sth - */ - if(msym == '@' || - ('a' <= msym && msym <= 'z')) { - extern coord *gettrack(); - register coord *cp; - schar mroom; - mroom = inroom(omx,omy); - if(mroom < 0 || mroom != inroom(u.ux,u.uy)){ - cp = gettrack(omx,omy); - if(cp){ - gx = cp->x; - gy = cp->y; - } - } - } - - /* look for gold or jewels nearby */ - likegold = (index("LOD", msym) != NULL); - likegems = (index("ODu", msym) != NULL); - likeobjs = mtmp->mhide; -#define SRCHRADIUS 25 - { xchar mind = SRCHRADIUS; /* not too far away */ - register int dd; - if(likegold){ - register struct gold *gold; - for(gold = fgold; gold; gold = gold->ngold) - if((dd = DIST(omx,omy,gold->gx,gold->gy)) < mind){ - mind = dd; - gx = gold->gx; - gy = gold->gy; - } - } - if(likegems || likeobjs){ - register struct obj *otmp; - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(likeobjs || otmp->olet == GEM_SYM) - if(msym != 'u' || - objects[otmp->otyp].g_val != 0) - if((dd = DIST(omx,omy,otmp->ox,otmp->oy)) < mind){ - mind = dd; - gx = otmp->ox; - gy = otmp->oy; - } - } - if(mind < SRCHRADIUS && appr == -1) { - if(dist(omx,omy) < 10) { - gx = u.ux; - gy = u.uy; - } else - appr = 1; - } - } - nix = omx; - niy = omy; - cnt = mfndpos(mtmp,poss,info, - msym == 'u' ? NOTONL : - (msym == '@' || msym == '1') ? (ALLOW_SSM | ALLOW_TRAPS) : - index(UNDEAD, msym) ? NOGARLIC : ALLOW_TRAPS); - /* ALLOW_ROCK for some monsters ? */ - chcnt = 0; - chi = -1; - for(i=0; imtrack[j].x && ny == mtmp->mtrack[j].y) - if(rn2(4*(cnt-j))) goto nxti; -#ifdef STUPID - /* some stupid compilers think that this is too complicated */ - { int d1 = DIST(nx,ny,gx,gy); - int d2 = DIST(nix,niy,gx,gy); - nearer = (d1 < d2); - } -#else - nearer = (DIST(nx,ny,gx,gy) < DIST(nix,niy,gx,gy)); -#endif STUPID - if((appr == 1 && nearer) || (appr == -1 && !nearer) || - !mmoved || - (!appr && !rn2(++chcnt))){ - nix = nx; - niy = ny; - chi = i; - mmoved = 1; - } - nxti: ; - } - if(mmoved){ - if(info[chi] & ALLOW_M){ - mtmp2 = m_at(nix,niy); - if(hitmm(mtmp,mtmp2) == 1 && rn2(4) && - hitmm(mtmp2,mtmp) == 2) return(2); - return(0); - } - if(info[chi] & ALLOW_U){ - (void) hitu(mtmp, d(mtmp->data->damn, mtmp->data->damd)+1); - return(0); - } - mtmp->mx = nix; - mtmp->my = niy; - for(j=MTSZ-1; j>0; j--) mtmp->mtrack[j] = mtmp->mtrack[j-1]; - mtmp->mtrack[0].x = omx; - mtmp->mtrack[0].y = omy; -#ifndef NOWORM - if(mtmp->wormno) worm_move(mtmp); -#endif NOWORM - } else { - if(msym == 'u' && rn2(2)){ - rloc(mtmp); - return(0); - } -#ifndef NOWORM - if(mtmp->wormno) worm_nomove(mtmp); -#endif NOWORM - } -postmov: - if(mmoved == 1) { - if(mintrap(mtmp) == 2) /* he died */ - return(2); - if(likegold) mpickgold(mtmp); - if(likegems) mpickgems(mtmp); - if(mtmp->mhide) mtmp->mundetected = 1; - } - pmon(mtmp); - return(mmoved); -} - -mpickgold(mtmp) register struct monst *mtmp; { -register struct gold *gold; - while(gold = g_at(mtmp->mx, mtmp->my)){ - mtmp->mgold += gold->amount; - freegold(gold); - if(levl[mtmp->mx][mtmp->my].scrsym == '$') - newsym(mtmp->mx, mtmp->my); - } -} - -mpickgems(mtmp) register struct monst *mtmp; { -register struct obj *otmp; - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(otmp->olet == GEM_SYM) - if(otmp->ox == mtmp->mx && otmp->oy == mtmp->my) - if(mtmp->data->mlet != 'u' || objects[otmp->otyp].g_val != 0){ - freeobj(otmp); - mpickobj(mtmp, otmp); - if(levl[mtmp->mx][mtmp->my].scrsym == GEM_SYM) - newsym(mtmp->mx, mtmp->my); /* %% */ - return; /* pick only one object */ - } -} - -/* return number of acceptable neighbour positions */ -mfndpos(mon,poss,info,flag) -register struct monst *mon; -coord poss[9]; -int info[9], flag; -{ - register int x,y,nx,ny,cnt = 0,ntyp; - register struct monst *mtmp; - int nowtyp; - boolean pool; - - x = mon->mx; - y = mon->my; - nowtyp = levl[x][y].typ; - - pool = (mon->data->mlet == ';'); -nexttry: /* eels prefer the water, but if there is no water nearby, - they will crawl over land */ - if(mon->mconf) { - flag |= ALLOW_ALL; - flag &= ~NOTONL; - } - for(nx = x-1; nx <= x+1; nx++) for(ny = y-1; ny <= y+1; ny++) - if(nx != x || ny != y) if(isok(nx,ny)) - if(!IS_ROCK(ntyp = levl[nx][ny].typ)) - if(!(nx != x && ny != y && (nowtyp == DOOR || ntyp == DOOR))) - if((ntyp == POOL) == pool) { - info[cnt] = 0; - if(nx == u.ux && ny == u.uy){ - if(!(flag & ALLOW_U)) continue; - info[cnt] = ALLOW_U; - } else if(mtmp = m_at(nx,ny)){ - if(!(flag & ALLOW_M)) continue; - info[cnt] = ALLOW_M; - if(mtmp->mtame){ - if(!(flag & ALLOW_TM)) continue; - info[cnt] |= ALLOW_TM; - } - } - if(sobj_at(CLOVE_OF_GARLIC, nx, ny)) { - if(flag & NOGARLIC) continue; - info[cnt] |= NOGARLIC; - } - if(sobj_at(SCR_SCARE_MONSTER, nx, ny) || - (!mon->mpeaceful && sengr_at("Elbereth", nx, ny))) { - if(!(flag & ALLOW_SSM)) continue; - info[cnt] |= ALLOW_SSM; - } - if(sobj_at(ENORMOUS_ROCK, nx, ny)) { - if(!(flag & ALLOW_ROCK)) continue; - info[cnt] |= ALLOW_ROCK; - } - if(!Invis && online(nx,ny)){ - if(flag & NOTONL) continue; - info[cnt] |= NOTONL; - } - /* we cannot avoid traps of an unknown kind */ - { register struct trap *ttmp = t_at(nx, ny); - register int tt; - if(ttmp) { - tt = 1 << ttmp->ttyp; - if(mon->mtrapseen & tt){ - if(!(flag & tt)) continue; - info[cnt] |= tt; - } - } - } - poss[cnt].x = nx; - poss[cnt].y = ny; - cnt++; - } - if(!cnt && pool && nowtyp != POOL) { - pool = FALSE; - goto nexttry; - } - return(cnt); -} - -dist(x,y) int x,y; { - return((x-u.ux)*(x-u.ux) + (y-u.uy)*(y-u.uy)); -} - -poisoned(string, pname) -register char *string, *pname; -{ - register int i; - - if(Blind) pline("It was poisoned."); - else pline("The %s was poisoned!",string); - if(Poison_resistance) { - pline("The poison doesn't seem to affect you."); - return; - } - i = rn2(10); - if(i == 0) { - u.uhp = -1; - pline("I am afraid the poison was deadly ..."); - } else if(i <= 5) { - losestr(rn1(3,3)); - } else { - losehp(rn1(10,6), pname); - } - if(u.uhp < 1) { - killer = pname; - done("died"); - } -} - -mondead(mtmp) -register struct monst *mtmp; -{ - relobj(mtmp,1); - unpmon(mtmp); - relmon(mtmp); - unstuck(mtmp); - if(mtmp->isshk) shkdead(mtmp); - if(mtmp->isgd) gddead(); -#ifndef NOWORM - if(mtmp->wormno) wormdead(mtmp); -#endif NOWORM - monfree(mtmp); -} - -/* called when monster is moved to larger structure */ -replmon(mtmp,mtmp2) -register struct monst *mtmp, *mtmp2; -{ - relmon(mtmp); - monfree(mtmp); - mtmp2->nmon = fmon; - fmon = mtmp2; - if(u.ustuck == mtmp) u.ustuck = mtmp2; - if(mtmp2->isshk) replshk(mtmp,mtmp2); - if(mtmp2->isgd) replgd(mtmp,mtmp2); -} - -relmon(mon) -register struct monst *mon; -{ - register struct monst *mtmp; - - if(mon == fmon) fmon = fmon->nmon; - else { - for(mtmp = fmon; mtmp->nmon != mon; mtmp = mtmp->nmon) ; - mtmp->nmon = mon->nmon; - } -} - -/* we do not free monsters immediately, in order to have their name - available shortly after their demise */ -struct monst *fdmon; /* chain of dead monsters, need not to be saved */ - -monfree(mtmp) register struct monst *mtmp; { - mtmp->nmon = fdmon; - fdmon = mtmp; -} - -dmonsfree(){ -register struct monst *mtmp; - while(mtmp = fdmon){ - fdmon = mtmp->nmon; - free((char *) mtmp); - } -} - -unstuck(mtmp) -register struct monst *mtmp; -{ - if(u.ustuck == mtmp) { - if(u.uswallow){ - u.ux = mtmp->mx; - u.uy = mtmp->my; - u.uswallow = 0; - setsee(); - docrt(); - } - u.ustuck = 0; - } -} - -killed(mtmp) -register struct monst *mtmp; -{ -#ifdef lint -#define NEW_SCORING -#endif lint - register int tmp,tmp2,nk,x,y; - register struct permonst *mdat; - extern long newuexp(); - - if(mtmp->cham) mtmp->data = PM_CHAMELEON; - mdat = mtmp->data; - if(Blind) pline("You destroy it!"); - else { - pline("You destroy %s!", - mtmp->mtame ? amonnam(mtmp, "poor") : monnam(mtmp)); - } - if(u.umconf) { - if(!Blind) pline("Your hands stop glowing blue."); - u.umconf = 0; - } - - /* count killed monsters */ -#define MAXMONNO 100 - nk = 1; /* in case we cannot find it in mons */ - tmp = mdat - mons; /* index in mons array (if not 'd', '@', ...) */ - if(tmp >= 0 && tmp < CMNUM+2) { - extern char fut_geno[]; - u.nr_killed[tmp]++; - if((nk = u.nr_killed[tmp]) > MAXMONNO && - !index(fut_geno, mdat->mlet)) - charcat(fut_geno, mdat->mlet); - } - - /* punish bad behaviour */ - if(mdat->mlet == '@') Telepat = 0, u.uluck -= 2; - if(mtmp->mpeaceful || mtmp->mtame) u.uluck--; - if(mdat->mlet == 'u') u.uluck -= 5; - if((int)u.uluck < LUCKMIN) u.uluck = LUCKMIN; - - /* give experience points */ - tmp = 1 + mdat->mlevel * mdat->mlevel; - if(mdat->ac < 3) tmp += 2*(7 - mdat->ac); - if(index("AcsSDXaeRTVWU&In:P", mdat->mlet)) - tmp += 2*mdat->mlevel; - if(index("DeV&P",mdat->mlet)) tmp += (7*mdat->mlevel); - if(mdat->mlevel > 6) tmp += 50; - if(mdat->mlet == ';') tmp += 1000; - -#ifdef NEW_SCORING - /* ------- recent addition: make nr of points decrease - when this is not the first of this kind */ - { int ul = u.ulevel; - int ml = mdat->mlevel; - - if(ul < 14) /* points are given based on present and future level */ - for(tmp2 = 0; !tmp2 || ul + tmp2 <= ml; tmp2++) - if(u.uexp + 1 + (tmp + ((tmp2 <= 0) ? 0 : 4<<(tmp2-1)))/nk - >= 10*pow((unsigned)(ul-1))) - if(++ul == 14) break; - - tmp2 = ml - ul -1; - tmp = (tmp + ((tmp2 < 0) ? 0 : 4<= newuexp()){ - pline("Welcome to experience level %u.", ++u.ulevel); - tmp = rnd(10); - if(tmp < 3) tmp = rnd(10); - u.uhpmax += tmp; - u.uhp += tmp; - flags.botl = 1; - } - - /* dispose of monster and make cadaver */ - x = mtmp->mx; y = mtmp->my; - mondead(mtmp); - tmp = mdat->mlet; - if(tmp == 'm') { /* he killed a minotaur, give him a wand of digging */ - /* note: the dead minotaur will be on top of it! */ - mksobj_at(WAN_DIGGING, x, y); - /* if(cansee(x,y)) atl(x,y,fobj->olet); */ - stackobj(fobj); - } else -#ifndef NOWORM - if(tmp == 'w') { - mksobj_at(WORM_TOOTH, x, y); - stackobj(fobj); - } else -#endif NOWORM - if(!letter(tmp) || (!index("mw", tmp) && !rn2(3))) tmp = 0; - - if(ACCESSIBLE(levl[x][y].typ)) /* might be mimic in wall or dead eel*/ - if(x != u.ux || y != u.uy) /* might be here after swallowed */ - if(index("NTVm&",mdat->mlet) || rn2(5)) { - register struct obj *obj2 = mkobj_at(tmp,x,y); - if(cansee(x,y)) - atl(x,y,obj2->olet); - stackobj(obj2); - } -} - -kludge(str,arg) -register char *str,*arg; -{ - if(Blind) { - if(*str == '%') pline(str,"It"); - else pline(str,"it"); - } else pline(str,arg); -} - -rescham() /* force all chameleons to become normal */ -{ - register struct monst *mtmp; - - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) - if(mtmp->cham) { - mtmp->cham = 0; - (void) newcham(mtmp, PM_CHAMELEON); - } -} - -newcham(mtmp,mdat) /* make a chameleon look like a new monster */ - /* returns 1 if the monster actually changed */ -register struct monst *mtmp; -register struct permonst *mdat; -{ - register mhp, hpn, hpd; - - if(mdat == mtmp->data) return(0); /* still the same monster */ -#ifndef NOWORM - if(mtmp->wormno) wormdead(mtmp); /* throw tail away */ -#endif NOWORM - if (u.ustuck == mtmp) { - if (u.uswallow) { - u.uswallow = 0; - u.uswldtim = 0; - mnexto (mtmp); - docrt (); - prme (); - } - u.ustuck = 0; - } - hpn = mtmp->mhp; - hpd = (mtmp->data->mlevel)*8; - if(!hpd) hpd = 4; - mtmp->data = mdat; - mhp = (mdat->mlevel)*8; - /* new hp: same fraction of max as before */ - mtmp->mhp = 2 + (hpn*mhp)/hpd; - hpn = mtmp->mhpmax; - mtmp->mhpmax = 2 + (hpn*mhp)/hpd; - mtmp->minvis = (mdat->mlet == 'I') ? 1 : 0; -#ifndef NOWORM - if(mdat->mlet == 'w' && getwn(mtmp)) initworm(mtmp); - /* perhaps we should clear mtmp->mtame here? */ -#endif NOWORM - unpmon(mtmp); /* necessary for 'I' and to force pmon */ - pmon(mtmp); - return(1); -} - -mnexto(mtmp) /* Make monster mtmp next to you (if possible) */ -struct monst *mtmp; -{ - extern coord enexto(); - coord mm; - mm = enexto(u.ux, u.uy); - mtmp->mx = mm.x; - mtmp->my = mm.y; - pmon(mtmp); -} - -ishuman(mtmp) register struct monst *mtmp; { - return(mtmp->data->mlet == '@'); -} - -setmangry(mtmp) register struct monst *mtmp; { - if(!mtmp->mpeaceful) return; - if(mtmp->mtame) return; - mtmp->mpeaceful = 0; - if(ishuman(mtmp)) pline("%s gets angry!", Monnam(mtmp)); -} - -/* not one hundred procent correct: now a snake may hide under an - invisible object */ -canseemon(mtmp) -register struct monst *mtmp; -{ - return((!mtmp->minvis || See_invisible) - && (!mtmp->mhide || !o_at(mtmp->mx,mtmp->my)) - && cansee(mtmp->mx, mtmp->my)); -} diff --git a/games/hack/hack.monst.c b/games/hack/hack.monst.c deleted file mode 100644 index b682b59de230..000000000000 --- a/games/hack/hack.monst.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.monst.c - version 1.0.2 */ - -#include "hack.h" -#include "def.eshk.h" -extern char plname[PL_NSIZ]; - -struct permonst mons[CMNUM+2] = { - { "bat", 'B',1,22,8,1,4,0 }, - { "gnome", 'G',1,6,5,1,6,0 }, - { "hobgoblin", 'H',1,9,5,1,8,0 }, - { "jackal", 'J',0,12,7,1,2,0 }, - { "kobold", 'K',1,6,7,1,4,0 }, - { "leprechaun", 'L',5,15,8,1,2,0 }, - { "giant rat", 'r',0,12,7,1,3,0 }, - { "acid blob", 'a',2,3,8,0,0,0 }, - { "floating eye", 'E',2,1,9,0,0,0 }, - { "homunculus", 'h',2,6,6,1,3,0 }, - { "imp", 'i',2,6,2,1,4,0 }, - { "orc", 'O',2,9,6,1,8,0 }, - { "yellow light", 'y',3,15,0,0,0,0 }, - { "zombie", 'Z',2,6,8,1,8,0 }, - { "giant ant", 'A',3,18,3,1,6,0 }, - { "fog cloud", 'f',3,1,0,1,6,0 }, - { "nymph", 'N',6,12,9,1,2,0 }, - { "piercer", 'p',3,1,3,2,6,0 }, - { "quasit", 'Q',3,15,3,1,4,0 }, - { "quivering blob", 'q',3,1,8,1,8,0 }, - { "violet fungi", 'v',3,1,7,1,4,0 }, - { "giant beetle", 'b',4,6,4,3,4,0 }, - { "centaur", 'C',4,18,4,1,6,0 }, - { "cockatrice", 'c',4,6,6,1,3,0 }, - { "gelatinous cube", 'g',4,6,8,2,4,0 }, - { "jaguar", 'j',4,15,6,1,8,0 }, - { "killer bee", 'k',4,14,4,2,4,0 }, - { "snake", 'S',4,15,3,1,6,0 }, - { "freezing sphere", 'F',2,13,4,0,0,0 }, - { "owlbear", 'o',5,12,5,2,6,0 }, - { "rust monster", 'R',10,18,3,0,0,0 }, - { "scorpion", 's',5,15,3,1,4,0 }, - { "tengu", 't',5,13,5,1,7,0 }, - { "wraith", 'W',5,12,5,1,6,0 }, -#ifdef NOWORM - { "wumpus", 'w',8,3,2,3,6,0 }, -#else - { "long worm", 'w',8,3,5,1,4,0 }, -#endif NOWORM - { "large dog", 'd',6,15,4,2,4,0 }, - { "leocrotta", 'l',6,18,4,3,6,0 }, - { "mimic", 'M',7,3,7,3,4,0 }, - { "troll", 'T',7,12,4,2,7,0 }, - { "unicorn", 'u',8,24,5,1,10,0 }, - { "yeti", 'Y',5,15,6,1,6,0 }, - { "stalker", 'I',8,12,3,4,4,0 }, - { "umber hulk", 'U',9,6,2,2,10,0 }, - { "vampire", 'V',8,12,1,1,6,0 }, - { "xorn", 'X',8,9,-2,4,6,0 }, - { "xan", 'x',7,18,-2,2,4,0 }, - { "zruty", 'z',9,8,3,3,6,0 }, - { "chameleon", ':',6,5,6,4,2,0 }, - { "dragon", 'D',10,9,-1,3,8,0 }, - { "ettin", 'e',10,12,3,2,8,0 }, - { "lurker above", '\'',10,3,3,0,0,0 }, - { "nurse", 'n',11,6,0,1,3,0 }, - { "trapper", ',',12,3,3,0,0,0 }, - { "purple worm", 'P',15,9,6,2,8,0 }, - { "demon", '&',10,12,-4,1,4,0 }, - { "minotaur", 'm',15,15,6,4,10,0 }, - { "shopkeeper", '@', 12, 18, 0, 4, 8, sizeof(struct eshk) } -}; - -struct permonst pm_ghost = { "ghost", ' ', 10, 3, -5, 1, 1, sizeof(plname) }; -struct permonst pm_wizard = { - "wizard of Yendor", '1', 15, 12, -2, 1, 12, 0 -}; -#ifdef MAIL -struct permonst pm_mail_daemon = { "mail daemon", '2', 100, 1, 10, 0, 0, 0 }; -#endif MAIL -struct permonst pm_eel = { "giant eel", ';', 15, 6, -3, 3, 6, 0 }; diff --git a/games/hack/hack.o_init.c b/games/hack/hack.o_init.c deleted file mode 100644 index 37b33aefb081..000000000000 --- a/games/hack/hack.o_init.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.o_init.c - version 1.0.3 */ - -#include "config.h" /* for typedefs */ -#include "def.objects.h" -#include "hack.onames.h" /* for LAST_GEM */ -extern char *index(); - -int -letindex(let) register char let; { -register int i = 0; -register char ch; - while((ch = obj_symbols[i++]) != 0) - if(ch == let) return(i); - return(0); -} - -init_objects(){ -register int i, j, first, last, sum, end; -register char let, *tmp; - /* init base; if probs given check that they add up to 100, - otherwise compute probs; shuffle descriptions */ - end = SIZE(objects); - first = 0; - while( first < end ) { - let = objects[first].oc_olet; - last = first+1; - while(last < end && objects[last].oc_olet == let - && objects[last].oc_name != NULL) - last++; - i = letindex(let); - if((!i && let != ILLOBJ_SYM) || bases[i] != 0) - error("initialization error"); - bases[i] = first; - - if(let == GEM_SYM) - setgemprobs(); - check: - sum = 0; - for(j = first; j < last; j++) sum += objects[j].oc_prob; - if(sum == 0) { - for(j = first; j < last; j++) - objects[j].oc_prob = (100+j-first)/(last-first); - goto check; - } - if(sum != 100) - error("init-prob error for %c", let); - - if(objects[first].oc_descr != NULL && let != TOOL_SYM){ - /* shuffle, also some additional descriptions */ - while(last < end && objects[last].oc_olet == let) - last++; - j = last; - while(--j > first) { - i = first + rn2(j+1-first); - tmp = objects[j].oc_descr; - objects[j].oc_descr = objects[i].oc_descr; - objects[i].oc_descr = tmp; - } - } - first = last; - } -} - -probtype(let) register char let; { -register int i = bases[letindex(let)]; -register int prob = rn2(100); - while((prob -= objects[i].oc_prob) >= 0) i++; - if(objects[i].oc_olet != let || !objects[i].oc_name) - panic("probtype(%c) error, i=%d", let, i); - return(i); -} - -setgemprobs() -{ - register int j,first; - extern xchar dlevel; - - first = bases[letindex(GEM_SYM)]; - - for(j = 0; j < 9-dlevel/3; j++) - objects[first+j].oc_prob = 0; - first += j; - if(first >= LAST_GEM || first >= SIZE(objects) || - objects[first].oc_olet != GEM_SYM || - objects[first].oc_name == NULL) - printf("Not enough gems? - first=%d j=%d LAST_GEM=%d\n", - first, j, LAST_GEM); - for(j = first; j < LAST_GEM; j++) - objects[j].oc_prob = (20+j-first)/(LAST_GEM-first); -} - -oinit() /* level dependent initialization */ -{ - setgemprobs(); -} - -extern long *alloc(); - -savenames(fd) register fd; { -register int i; -unsigned len; - bwrite(fd, (char *) bases, sizeof bases); - bwrite(fd, (char *) objects, sizeof objects); - /* as long as we use only one version of Hack/Quest we - need not save oc_name and oc_descr, but we must save - oc_uname for all objects */ - for(i=0; i < SIZE(objects); i++) { - if(objects[i].oc_uname) { - len = strlen(objects[i].oc_uname)+1; - bwrite(fd, (char *) &len, sizeof len); - bwrite(fd, objects[i].oc_uname, len); - } - } -} - -restnames(fd) register fd; { -register int i; -unsigned len; - mread(fd, (char *) bases, sizeof bases); - mread(fd, (char *) objects, sizeof objects); - for(i=0; i < SIZE(objects); i++) if(objects[i].oc_uname) { - mread(fd, (char *) &len, sizeof len); - objects[i].oc_uname = (char *) alloc(len); - mread(fd, objects[i].oc_uname, len); - } -} - -dodiscovered() /* free after Robert Viduya */ -{ - extern char *typename(); - register int i, end; - int ct = 0; - - cornline(0, "Discoveries"); - - end = SIZE(objects); - for (i = 0; i < end; i++) { - if (interesting_to_discover (i)) { - ct++; - cornline(1, typename(i)); - } - } - if (ct == 0) { - pline ("You haven't discovered anything yet..."); - cornline(3, (char *) 0); - } else - cornline(2, (char *) 0); - - return(0); -} - -interesting_to_discover(i) -register int i; -{ - return( - objects[i].oc_uname != NULL || - (objects[i].oc_name_known && objects[i].oc_descr != NULL) - ); -} diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c deleted file mode 100644 index a1c966cd912e..000000000000 --- a/games/hack/hack.objnam.c +++ /dev/null @@ -1,547 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.objnam.c - version 1.0.2 */ - -#include "hack.h" -#define Sprintf (void) sprintf -#define Strcat (void) strcat -#define Strcpy (void) strcpy -#define PREFIX 15 -extern char *eos(); -extern int bases[]; - -char * -strprepend(s,pref) register char *s, *pref; { -register int i = strlen(pref); - if(i > PREFIX) { - pline("WARNING: prefix too short."); - return(s); - } - s -= i; - (void) strncpy(s, pref, i); /* do not copy trailing 0 */ - return(s); -} - -char * -sitoa(a) int a; { -static char buf[13]; - Sprintf(buf, (a < 0) ? "%d" : "+%d", a); - return(buf); -} - -char * -typename(otyp) -register int otyp; -{ -static char buf[BUFSZ]; -register struct objclass *ocl = &objects[otyp]; -register char *an = ocl->oc_name; -register char *dn = ocl->oc_descr; -register char *un = ocl->oc_uname; -register int nn = ocl->oc_name_known; - switch(ocl->oc_olet) { - case POTION_SYM: - Strcpy(buf, "potion"); - break; - case SCROLL_SYM: - Strcpy(buf, "scroll"); - break; - case WAND_SYM: - Strcpy(buf, "wand"); - break; - case RING_SYM: - Strcpy(buf, "ring"); - break; - default: - if(nn) { - Strcpy(buf, an); - if(otyp >= TURQUOISE && otyp <= JADE) - Strcat(buf, " stone"); - if(un) - Sprintf(eos(buf), " called %s", un); - if(dn) - Sprintf(eos(buf), " (%s)", dn); - } else { - Strcpy(buf, dn ? dn : an); - if(ocl->oc_olet == GEM_SYM) - Strcat(buf, " gem"); - if(un) - Sprintf(eos(buf), " called %s", un); - } - return(buf); - } - /* here for ring/scroll/potion/wand */ - if(nn) - Sprintf(eos(buf), " of %s", an); - if(un) - Sprintf(eos(buf), " called %s", un); - if(dn) - Sprintf(eos(buf), " (%s)", dn); - return(buf); -} - -char * -xname(obj) -register struct obj *obj; -{ -static char bufr[BUFSZ]; -register char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */ -register int nn = objects[obj->otyp].oc_name_known; -register char *an = objects[obj->otyp].oc_name; -register char *dn = objects[obj->otyp].oc_descr; -register char *un = objects[obj->otyp].oc_uname; -register int pl = (obj->quan != 1); - if(!obj->dknown && !Blind) obj->dknown = 1; /* %% doesnt belong here */ - switch(obj->olet) { - case AMULET_SYM: - Strcpy(buf, (obj->spe < 0 && obj->known) - ? "cheap plastic imitation of the " : ""); - Strcat(buf,"Amulet of Yendor"); - break; - case TOOL_SYM: - if(!nn) { - Strcpy(buf, dn); - break; - } - Strcpy(buf,an); - break; - case FOOD_SYM: - if(obj->otyp == DEAD_HOMUNCULUS && pl) { - pl = 0; - Strcpy(buf, "dead homunculi"); - break; - } - /* fungis ? */ - /* fall into next case */ - case WEAPON_SYM: - if(obj->otyp == WORM_TOOTH && pl) { - pl = 0; - Strcpy(buf, "worm teeth"); - break; - } - if(obj->otyp == CRYSKNIFE && pl) { - pl = 0; - Strcpy(buf, "crysknives"); - break; - } - /* fall into next case */ - case ARMOR_SYM: - case CHAIN_SYM: - case ROCK_SYM: - Strcpy(buf,an); - break; - case BALL_SYM: - Sprintf(buf, "%sheavy iron ball", - (obj->owt > objects[obj->otyp].oc_weight) ? "very " : ""); - break; - case POTION_SYM: - if(nn || un || !obj->dknown) { - Strcpy(buf, "potion"); - if(pl) { - pl = 0; - Strcat(buf, "s"); - } - if(!obj->dknown) break; - if(un) { - Strcat(buf, " called "); - Strcat(buf, un); - } else { - Strcat(buf, " of "); - Strcat(buf, an); - } - } else { - Strcpy(buf, dn); - Strcat(buf, " potion"); - } - break; - case SCROLL_SYM: - Strcpy(buf, "scroll"); - if(pl) { - pl = 0; - Strcat(buf, "s"); - } - if(!obj->dknown) break; - if(nn) { - Strcat(buf, " of "); - Strcat(buf, an); - } else if(un) { - Strcat(buf, " called "); - Strcat(buf, un); - } else { - Strcat(buf, " labeled "); - Strcat(buf, dn); - } - break; - case WAND_SYM: - if(!obj->dknown) - Sprintf(buf, "wand"); - else if(nn) - Sprintf(buf, "wand of %s", an); - else if(un) - Sprintf(buf, "wand called %s", un); - else - Sprintf(buf, "%s wand", dn); - break; - case RING_SYM: - if(!obj->dknown) - Sprintf(buf, "ring"); - else if(nn) - Sprintf(buf, "ring of %s", an); - else if(un) - Sprintf(buf, "ring called %s", un); - else - Sprintf(buf, "%s ring", dn); - break; - case GEM_SYM: - if(!obj->dknown) { - Strcpy(buf, "gem"); - break; - } - if(!nn) { - Sprintf(buf, "%s gem", dn); - break; - } - Strcpy(buf, an); - if(obj->otyp >= TURQUOISE && obj->otyp <= JADE) - Strcat(buf, " stone"); - break; - default: - Sprintf(buf,"glorkum %c (0%o) %u %d", - obj->olet,obj->olet,obj->otyp,obj->spe); - } - if(pl) { - register char *p; - - for(p = buf; *p; p++) { - if(!strncmp(" of ", p, 4)) { - /* pieces of, cloves of, lumps of */ - register int c1, c2 = 's'; - - do { - c1 = c2; c2 = *p; *p++ = c1; - } while(c1); - goto nopl; - } - } - p = eos(buf)-1; - if(*p == 's' || *p == 'z' || *p == 'x' || - (*p == 'h' && p[-1] == 's')) - Strcat(buf, "es"); /* boxes */ - else if(*p == 'y' && !index(vowels, p[-1])) - Strcpy(p, "ies"); /* rubies, zruties */ - else - Strcat(buf, "s"); - } -nopl: - if(obj->onamelth) { - Strcat(buf, " named "); - Strcat(buf, ONAME(obj)); - } - return(buf); -} - -char * -doname(obj) -register struct obj *obj; -{ -char prefix[PREFIX]; -register char *bp = xname(obj); - if(obj->quan != 1) - Sprintf(prefix, "%u ", obj->quan); - else - Strcpy(prefix, "a "); - switch(obj->olet) { - case AMULET_SYM: - if(strncmp(bp, "cheap ", 6)) - Strcpy(prefix, "the "); - break; - case ARMOR_SYM: - if(obj->owornmask & W_ARMOR) - Strcat(bp, " (being worn)"); - /* fall into next case */ - case WEAPON_SYM: - if(obj->known) { - Strcat(prefix, sitoa(obj->spe)); - Strcat(prefix, " "); - } - break; - case WAND_SYM: - if(obj->known) - Sprintf(eos(bp), " (%d)", obj->spe); - break; - case RING_SYM: - if(obj->owornmask & W_RINGR) Strcat(bp, " (on right hand)"); - if(obj->owornmask & W_RINGL) Strcat(bp, " (on left hand)"); - if(obj->known && (objects[obj->otyp].bits & SPEC)) { - Strcat(prefix, sitoa(obj->spe)); - Strcat(prefix, " "); - } - break; - } - if(obj->owornmask & W_WEP) - Strcat(bp, " (weapon in hand)"); - if(obj->unpaid) - Strcat(bp, " (unpaid)"); - if(!strcmp(prefix, "a ") && index(vowels, *bp)) - Strcpy(prefix, "an "); - bp = strprepend(bp, prefix); - return(bp); -} - -/* used only in hack.fight.c (thitu) */ -setan(str,buf) -register char *str,*buf; -{ - if(index(vowels,*str)) - Sprintf(buf, "an %s", str); - else - Sprintf(buf, "a %s", str); -} - -char * -aobjnam(otmp,verb) register struct obj *otmp; register char *verb; { -register char *bp = xname(otmp); -char prefix[PREFIX]; - if(otmp->quan != 1) { - Sprintf(prefix, "%u ", otmp->quan); - bp = strprepend(bp, prefix); - } - - if(verb) { - /* verb is given in plural (i.e., without trailing s) */ - Strcat(bp, " "); - if(otmp->quan != 1) - Strcat(bp, verb); - else if(!strcmp(verb, "are")) - Strcat(bp, "is"); - else { - Strcat(bp, verb); - Strcat(bp, "s"); - } - } - return(bp); -} - -char * -Doname(obj) -register struct obj *obj; -{ - register char *s = doname(obj); - - if('a' <= *s && *s <= 'z') *s -= ('a' - 'A'); - return(s); -} - -char *wrp[] = { "wand", "ring", "potion", "scroll", "gem" }; -char wrpsym[] = { WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM }; - -struct obj * -readobjnam(bp) register char *bp; { -register char *p; -register int i; -int cnt, spe, spesgn, typ, heavy; -char let; -char *un, *dn, *an; -/* int the = 0; char *oname = 0; */ - cnt = spe = spesgn = typ = heavy = 0; - let = 0; - an = dn = un = 0; - for(p = bp; *p; p++) - if('A' <= *p && *p <= 'Z') *p += 'a'-'A'; - if(!strncmp(bp, "the ", 4)){ -/* the = 1; */ - bp += 4; - } else if(!strncmp(bp, "an ", 3)){ - cnt = 1; - bp += 3; - } else if(!strncmp(bp, "a ", 2)){ - cnt = 1; - bp += 2; - } - if(!cnt && digit(*bp)){ - cnt = atoi(bp); - while(digit(*bp)) bp++; - while(*bp == ' ') bp++; - } - if(!cnt) cnt = 1; /* %% what with "gems" etc. ? */ - - if(*bp == '+' || *bp == '-'){ - spesgn = (*bp++ == '+') ? 1 : -1; - spe = atoi(bp); - while(digit(*bp)) bp++; - while(*bp == ' ') bp++; - } else { - p = rindex(bp, '('); - if(p) { - if(p > bp && p[-1] == ' ') p[-1] = 0; - else *p = 0; - p++; - spe = atoi(p); - while(digit(*p)) p++; - if(strcmp(p, ")")) spe = 0; - else spesgn = 1; - } - } - /* now we have the actual name, as delivered by xname, say - green potions called whisky - scrolls labeled "QWERTY" - egg - dead zruties - fortune cookies - very heavy iron ball named hoei - wand of wishing - elven cloak - */ - for(p = bp; *p; p++) if(!strncmp(p, " named ", 7)) { - *p = 0; -/* oname = p+7; */ - } - for(p = bp; *p; p++) if(!strncmp(p, " called ", 8)) { - *p = 0; - un = p+8; - } - for(p = bp; *p; p++) if(!strncmp(p, " labeled ", 9)) { - *p = 0; - dn = p+9; - } - - /* first change to singular if necessary */ - if(cnt != 1) { - /* find "cloves of garlic", "worthless pieces of blue glass" */ - for(p = bp; *p; p++) if(!strncmp(p, "s of ", 5)){ - while(*p = p[1]) p++; - goto sing; - } - /* remove -s or -es (boxes) or -ies (rubies, zruties) */ - p = eos(bp); - if(p[-1] == 's') { - if(p[-2] == 'e') { - if(p[-3] == 'i') { - if(!strcmp(p-7, "cookies")) - goto mins; - Strcpy(p-3, "y"); - goto sing; - } - - /* note: cloves / knives from clove / knife */ - if(!strcmp(p-6, "knives")) { - Strcpy(p-3, "fe"); - goto sing; - } - - /* note: nurses, axes but boxes */ - if(!strcmp(p-5, "boxes")) { - p[-2] = 0; - goto sing; - } - } - mins: - p[-1] = 0; - } else { - if(!strcmp(p-9, "homunculi")) { - Strcpy(p-1, "us"); /* !! makes string longer */ - goto sing; - } - if(!strcmp(p-5, "teeth")) { - Strcpy(p-5, "tooth"); - goto sing; - } - /* here we cannot find the plural suffix */ - } - } -sing: - if(!strcmp(bp, "amulet of yendor")) { - typ = AMULET_OF_YENDOR; - goto typfnd; - } - p = eos(bp); - if(!strcmp(p-5, " mail")){ /* Note: ring mail is not a ring ! */ - let = ARMOR_SYM; - an = bp; - goto srch; - } - for(i = 0; i < sizeof(wrpsym); i++) { - register int j = strlen(wrp[i]); - if(!strncmp(bp, wrp[i], j)){ - let = wrpsym[i]; - bp += j; - if(!strncmp(bp, " of ", 4)) an = bp+4; - /* else if(*bp) ?? */ - goto srch; - } - if(!strcmp(p-j, wrp[i])){ - let = wrpsym[i]; - p -= j; - *p = 0; - if(p[-1] == ' ') p[-1] = 0; - dn = bp; - goto srch; - } - } - if(!strcmp(p-6, " stone")){ - p[-6] = 0; - let = GEM_SYM; - an = bp; - goto srch; - } - if(!strcmp(bp, "very heavy iron ball")){ - heavy = 1; - typ = HEAVY_IRON_BALL; - goto typfnd; - } - an = bp; -srch: - if(!an && !dn && !un) - goto any; - i = 1; - if(let) i = bases[letindex(let)]; - while(i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)){ - register char *zn = objects[i].oc_name; - - if(!zn) goto nxti; - if(an && strcmp(an, zn)) - goto nxti; - if(dn && (!(zn = objects[i].oc_descr) || strcmp(dn, zn))) - goto nxti; - if(un && (!(zn = objects[i].oc_uname) || strcmp(un, zn))) - goto nxti; - typ = i; - goto typfnd; - nxti: - i++; - } -any: - if(!let) let = wrpsym[rn2(sizeof(wrpsym))]; - typ = probtype(let); -typfnd: - { register struct obj *otmp; - extern struct obj *mksobj(); - let = objects[typ].oc_olet; - otmp = mksobj(typ); - if(heavy) - otmp->owt += 15; - if(cnt > 0 && index("%?!*)", let) && - (cnt < 4 || (let == WEAPON_SYM && typ <= ROCK && cnt < 20))) - otmp->quan = cnt; - - if(spe > 3 && spe > otmp->spe) - spe = 0; - else if(let == WAND_SYM) - spe = otmp->spe; - if(spe == 3 && u.uluck < 0) - spesgn = -1; - if(let != WAND_SYM && spesgn == -1) - spe = -spe; - if(let == BALL_SYM) - spe = 0; - else if(let == AMULET_SYM) - spe = -1; - else if(typ == WAN_WISHING && rn2(10)) - spe = (rn2(10) ? -1 : 0); - otmp->spe = spe; - - if(spesgn == -1) - otmp->cursed = 1; - - return(otmp); - } -} diff --git a/games/hack/hack.options.c b/games/hack/hack.options.c deleted file mode 100644 index ed95de310ead..000000000000 --- a/games/hack/hack.options.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.options.c - version 1.0.3 */ - -#include "config.h" -#include "hack.h" -extern char *eos(); - -initoptions() -{ - register char *opts; - extern char *getenv(); - - flags.time = flags.nonews = flags.notombstone = flags.end_own = - flags.standout = flags.nonull = FALSE; - flags.no_rest_on_space = TRUE; - flags.invlet_constant = TRUE; - flags.end_top = 5; - flags.end_around = 4; - flags.female = FALSE; /* players are usually male */ - - if(opts = getenv("HACKOPTIONS")) - parseoptions(opts,TRUE); -} - -parseoptions(opts, from_env) -register char *opts; -boolean from_env; -{ - register char *op,*op2; - unsigned num; - boolean negated; - - if(op = index(opts, ',')) { - *op++ = 0; - parseoptions(op, from_env); - } - if(op = index(opts, ' ')) { - op2 = op; - while(*op++) - if(*op != ' ') *op2++ = *op; - } - if(!*opts) return; - negated = FALSE; - while((*opts == '!') || !strncmp(opts, "no", 2)) { - if(*opts == '!') opts++; else opts += 2; - negated = !negated; - } - - if(!strncmp(opts,"standout",8)) { - flags.standout = !negated; - return; - } - - if(!strncmp(opts,"null",3)) { - flags.nonull = negated; - return; - } - - if(!strncmp(opts,"tombstone",4)) { - flags.notombstone = negated; - return; - } - - if(!strncmp(opts,"news",4)) { - flags.nonews = negated; - return; - } - - if(!strncmp(opts,"time",4)) { - flags.time = !negated; - flags.botl = 1; - return; - } - - if(!strncmp(opts,"restonspace",4)) { - flags.no_rest_on_space = negated; - return; - } - - if(!strncmp(opts,"fixinv",4)) { - if(from_env) - flags.invlet_constant = !negated; - else - pline("The fixinvlet option must be in HACKOPTIONS."); - return; - } - - if(!strncmp(opts,"male",4)) { - flags.female = negated; - return; - } - if(!strncmp(opts,"female",6)) { - flags.female = !negated; - return; - } - - /* name:string */ - if(!strncmp(opts,"name",4)) { - extern char plname[PL_NSIZ]; - if(!from_env) { - pline("The playername can be set only from HACKOPTIONS."); - return; - } - op = index(opts,':'); - if(!op) goto bad; - (void) strncpy(plname, op+1, sizeof(plname)-1); - return; - } - - /* endgame:5t[op] 5a[round] o[wn] */ - if(!strncmp(opts,"endgame",3)) { - op = index(opts,':'); - if(!op) goto bad; - op++; - while(*op) { - num = 1; - if(digit(*op)) { - num = atoi(op); - while(digit(*op)) op++; - } else - if(*op == '!') { - negated = !negated; - op++; - } - switch(*op) { - case 't': - flags.end_top = num; - break; - case 'a': - flags.end_around = num; - break; - case 'o': - flags.end_own = !negated; - break; - default: - goto bad; - } - while(letter(*++op)) ; - if(*op == '/') op++; - } - return; - } -bad: - if(!from_env) { - if(!strncmp(opts, "help", 4)) { - pline("%s%s%s", -"To set options use `HACKOPTIONS=\"\"' in your environment, or ", -"give the command 'o' followed by the line `' while playing. ", -"Here is a list of