Browse Source

Plan 9 from Bell Labs 2007-03-13

David du Colombier 13 years ago
parent
commit
30bc379b87
45 changed files with 2520 additions and 1681 deletions
  1. 66 65
      dist/replica/_plan9.db
  2. 66 62
      dist/replica/plan9.db
  3. 66 0
      dist/replica/plan9.log
  4. 1 0
      lib/face/48x48x8/.dict
  5. BIN
      lib/face/48x48x8/f/fgb.1
  6. 10 0
      lib/vgadb
  7. 19 2
      rc/bin/fshalt
  8. 3 1
      rc/bin/label
  9. 1 1
      rc/bin/man
  10. 2 0
      sys/games/lib/fortunes
  11. 2 0
      sys/lib/dist/mkfile
  12. 48 0
      sys/man/8/fshalt
  13. 1 1
      sys/man/8/listen
  14. 1 1
      sys/src/ape/lib/ap/plan9/kill.c
  15. 3 1
      sys/src/ape/lib/ap/syscall/genall
  16. 3 1
      sys/src/ape/lib/ap/syscall/mkfile
  17. 13 7
      sys/src/cmd/aux/listen.c
  18. 120 98
      sys/src/cmd/fossil/check.c
  19. 2 1
      sys/src/cmd/fossil/flproto
  20. 9 0
      sys/src/cmd/mkfile
  21. 12 10
      sys/src/cmd/ndb/convDNS2M.c
  22. 100 184
      sys/src/cmd/ndb/convM2DNS.c
  23. 1 1
      sys/src/cmd/ndb/csquery.c
  24. 50 48
      sys/src/cmd/ndb/dblookup.c
  25. 1142 0
      sys/src/cmd/ndb/dn.acid
  26. 141 251
      sys/src/cmd/ndb/dn.c
  27. 28 30
      sys/src/cmd/ndb/dnarea.c
  28. 14 13
      sys/src/cmd/ndb/dnnotify.c
  29. 95 367
      sys/src/cmd/ndb/dnresolve.c
  30. 122 142
      sys/src/cmd/ndb/dns.c
  31. 134 140
      sys/src/cmd/ndb/dns.h
  32. 61 63
      sys/src/cmd/ndb/dnsdebug.c
  33. 22 37
      sys/src/cmd/ndb/dnserver.c
  34. 1 1
      sys/src/cmd/ndb/dnsquery.c
  35. 51 60
      sys/src/cmd/ndb/dnstcp.c
  36. 38 50
      sys/src/cmd/ndb/dnudpserver.c
  37. 0 4
      sys/src/cmd/ndb/mkfile
  38. 9 9
      sys/src/cmd/ndb/query.c
  39. 26 0
      sys/src/cmd/ndb/time.c
  40. 1 0
      sys/src/fs/dev/juke.c
  41. 9 3
      sys/src/fs/pc/lock.c
  42. 12 15
      sys/src/fs/port/con.c
  43. 13 5
      sys/src/fs/port/time.c
  44. 1 6
      sys/src/libc/9syscall/mkfile
  45. 1 1
      sys/src/libndb/ndbopen.c

+ 66 - 65
dist/replica/_plan9.db

@@ -22,21 +22,21 @@
 386/bin/acid - 775 sys sys 1172808055 401961
 386/bin/acme - 775 sys sys 1168402263 432256
 386/bin/ape - 20000000775 sys sys 1016944144 0
-386/bin/ape/basename - 775 sys sys 1173039777 134719
+386/bin/ape/basename - 775 sys sys 1173754547 134719
 386/bin/ape/cc - 775 sys sys 1168402263 70642
-386/bin/ape/diff - 775 sys sys 1173039778 352264
-386/bin/ape/diff3 - 775 sys sys 1173039779 190364
-386/bin/ape/dirname - 775 sys sys 1173039779 134498
-386/bin/ape/expr - 775 sys sys 1173039780 144138
-386/bin/ape/kill - 775 sys sys 1173039781 140067
-386/bin/ape/make - 775 sys sys 1173039781 211605
-386/bin/ape/patch - 775 sys sys 1173039782 305848
+386/bin/ape/diff - 775 sys sys 1173754548 352264
+386/bin/ape/diff3 - 775 sys sys 1173754549 190364
+386/bin/ape/dirname - 775 sys sys 1173754549 134498
+386/bin/ape/expr - 775 sys sys 1173754549 144138
+386/bin/ape/kill - 775 sys sys 1173754550 140067
+386/bin/ape/make - 775 sys sys 1173754550 211605
+386/bin/ape/patch - 775 sys sys 1173754551 305848
 386/bin/ape/psh - 775 sys sys 1042220689 34
-386/bin/ape/sed - 775 sys sys 1173039783 160183
-386/bin/ape/sh - 775 sys sys 1173039783 481732
+386/bin/ape/sed - 775 sys sys 1173754551 160183
+386/bin/ape/sh - 775 sys sys 1173754552 481732
 386/bin/ape/stty - 775 sys sys 1148500571 41080
 386/bin/ape/tar - 775 sys sys 1168402264 62184
-386/bin/ape/uname - 775 sys sys 1173039784 134895
+386/bin/ape/uname - 775 sys sys 1173754552 134895
 386/bin/aquarela - 775 sys sys 1169612017 332788
 386/bin/ar - 775 sys sys 1168402265 113774
 386/bin/archfs - 775 sys sys 1168402265 147070
@@ -108,10 +108,10 @@
 386/bin/aux/hardcopy - 775 sys sys 1020319063 1699
 386/bin/aux/isvmware - 775 sys sys 1032486791 23997
 386/bin/aux/lines - 775 sys sys 1168402281 60716
-386/bin/aux/listen - 775 sys sys 1168402281 108803
+386/bin/aux/listen - 775 sys sys 1173754552 108570
 386/bin/aux/listen1 - 775 sys sys 1168402281 94721
-386/bin/aux/lpdaemon - 775 sys sys 1173039785 170710
-386/bin/aux/lpdsend - 775 sys sys 1173039785 157339
+386/bin/aux/lpdaemon - 775 sys sys 1173754553 170710
+386/bin/aux/lpdsend - 775 sys sys 1173754553 157339
 386/bin/aux/lpsend - 775 sys sys 1148500596 52590
 386/bin/aux/mapd - 775 sys sys 1168402282 191082
 386/bin/aux/mkflashfs - 775 sys sys 1168402282 67590
@@ -157,7 +157,7 @@
 386/bin/aux/write - 775 sys sys 1085077011 4188
 386/bin/aux/zerotrunc - 775 sys sys 1108268388 3891
 386/bin/awd - 775 sys sys 1168402289 58975
-386/bin/awk - 775 sys sys 1173039786 324980
+386/bin/awk - 775 sys sys 1173754554 324980
 386/bin/basename - 775 sys sys 1148500606 37919
 386/bin/bc - 775 sys sys 1168402290 82001
 386/bin/bind - 775 sys sys 1168402290 59805
@@ -186,7 +186,7 @@
 386/bin/col - 775 sys sys 1172029864 64995
 386/bin/colors - 775 sys sys 1168402296 150967
 386/bin/comm - 775 sys sys 1168402296 61586
-386/bin/compress - 775 sys sys 1173039787 166944
+386/bin/compress - 775 sys sys 1173754554 166944
 386/bin/con - 775 sys sys 1168402297 78486
 386/bin/cp - 775 sys sys 1168402297 63454
 386/bin/cpp - 775 sys sys 1168402297 150459
@@ -223,7 +223,7 @@
 386/bin/du - 775 sys sys 1168402304 74244
 386/bin/echo - 775 sys sys 1168402304 57592
 386/bin/ed - 775 sys sys 1168402304 93272
-386/bin/eqn - 775 sys sys 1173039787 244858
+386/bin/eqn - 775 sys sys 1173754555 244858
 386/bin/execnet - 775 sys sys 1168402305 178216
 386/bin/exportfs - 775 sys sys 1168402305 162550
 386/bin/ext2srv - 775 sys sys 1168402306 179893
@@ -235,9 +235,9 @@
 386/bin/fortune - 775 sys sys 1168402308 67356
 386/bin/fossil - 20000000775 sys sys 1042005470 0
 386/bin/fossil/conf - 775 sys sys 1085077052 1506
-386/bin/fossil/flchk - 775 sys sys 1168402308 239004
+386/bin/fossil/flchk - 775 sys sys 1173754556 239100
 386/bin/fossil/flfmt - 775 sys sys 1168402309 247151
-386/bin/fossil/fossil - 775 sys sys 1168402310 364442
+386/bin/fossil/fossil - 775 sys sys 1173754557 364538
 386/bin/fossil/last - 775 sys sys 1168402310 63550
 386/bin/freq - 775 sys sys 1168402310 62040
 386/bin/fs - 20000000775 sys sys 954380769 0
@@ -264,10 +264,10 @@
 386/bin/games/sudoku - 775 sys sys 1117249746 171666
 386/bin/getmap - 775 sys sys 1168402311 65423
 386/bin/gif - 775 sys sys 1168402312 158555
-386/bin/grap - 775 sys sys 1173039788 282722
+386/bin/grap - 775 sys sys 1173754557 282722
 386/bin/graph - 775 sys sys 1168402312 129250
 386/bin/grep - 775 sys sys 1168402312 79569
-386/bin/gs - 775 sys sys 1173039815 13278932
+386/bin/gs - 775 sys sys 1173754582 13278932
 386/bin/gunzip - 775 sys sys 1168402313 80523
 386/bin/gview - 775 sys sys 1168402313 238983
 386/bin/gzip - 775 sys sys 1168402313 84984
@@ -534,7 +534,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 1070519112 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1173410635 783116
+386/lib/ape/libap.a - 664 sys sys 1173754584 819938
 386/lib/ape/libbsd.a - 664 sys sys 1146156978 183900
 386/lib/ape/libdraw.a - 664 sys sys 1155491760 621772
 386/lib/ape/libfmt.a - 664 sys sys 1146156980 156706
@@ -1396,7 +1396,7 @@ lib/face/48x48x4/x/xigh.1 - 664 sys sys 1142019024 1204
 lib/face/48x48x4/y - 20000000775 sys sys 1020895714 0
 lib/face/48x48x4/z - 20000000775 sys sys 1020895714 0
 lib/face/48x48x8 - 20000000775 sys sys 1123100641 0
-lib/face/48x48x8/.dict - 664 sys sys 1172265593 2972
+lib/face/48x48x8/.dict - 664 sys sys 1173737462 3000
 lib/face/48x48x8/Z - 20000000775 sys sys 1020895714 0
 lib/face/48x48x8/a - 20000000775 sys sys 1056983599 0
 lib/face/48x48x8/a/alu.1 - 664 sys sys 1172265619 1719
@@ -1415,6 +1415,7 @@ lib/face/48x48x8/e - 20000000775 sys sys 1155331573 0
 lib/face/48x48x8/e/ericvh.2 - 664 sys sys 1155331573 1049
 lib/face/48x48x8/f - 20000000775 sys sys 1155331586 0
 lib/face/48x48x8/f/faa.1 - 664 sys sys 1172265611 2013
+lib/face/48x48x8/f/fgb.1 - 664 sys sys 1173737473 2966
 lib/face/48x48x8/f/forsyth.1 - 664 sys sys 1056982111 1864
 lib/face/48x48x8/f/fst.1 - 664 sys sys 1157149515 1099
 lib/face/48x48x8/g - 20000000775 sys sys 1140276024 0
@@ -5227,7 +5228,7 @@ lib/tftpd - 20000000775 sys sys 1020895767 0
 lib/unicode - 664 sys sys 958440028 223312
 lib/unicode.notice - 664 sys sys 958504386 1398
 lib/units - 664 sys sys 1071415518 9997
-lib/vgadb - 664 sys sys 1170456084 30303
+lib/vgadb - 664 sys sys 1173737426 30457
 lib/volcanoes - 664 sys sys 944944024 119831
 lib/words - 664 sys sys 1014923442 247097
 lp - 20000000775 sys sys 1079376135 0
@@ -5450,7 +5451,7 @@ rc/bin/dosmnt - 775 sys sys 1109288224 303
 rc/bin/eject - 775 sys sys 945617207 123
 rc/bin/fax - 775 sys sys 1127394677 2385
 rc/bin/fedex - 775 sys sys 1060187356 1244
-rc/bin/fshalt - 775 sys sys 1169491261 1401
+rc/bin/fshalt - 775 sys sys 1173737783 1652
 rc/bin/homespool - 775 sys sys 945617207 339
 rc/bin/ipconf - 20000000775 sys sys 1058791152 0
 rc/bin/ipconf/inside - 775 sys sys 1058790955 427
@@ -5462,13 +5463,13 @@ rc/bin/iwhois - 775 sys sys 1143979502 1637
 rc/bin/juke - 775 sys sys 1105565140 1131
 rc/bin/kill - 775 sys sys 1143389260 142
 rc/bin/kmem - 775 sys sys 1141940177 468
-rc/bin/label - 775 sys sys 1173121903 113
+rc/bin/label - 775 sys sys 1173737765 189
 rc/bin/lc - 775 sys sys 945617207 24
 rc/bin/leak - 775 sys sys 1172760642 1921
 rc/bin/lookman - 775 sys sys 1017679344 686
 rc/bin/lp - 775 sys sys 1162105982 5201
 rc/bin/mail - 775 sys sys 1045504003 138
-rc/bin/man - 775 sys sys 1172005212 2494
+rc/bin/man - 775 sys sys 1173755398 2504
 rc/bin/map - 775 sys sys 945617207 1576
 rc/bin/mapdemo - 775 sys sys 945617207 4075
 rc/bin/membername - 775 sys sys 945617207 89
@@ -5768,7 +5769,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1173279478 263737
+sys/games/lib/fortunes - 664 sys sys 1173736758 264000
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -6142,7 +6143,7 @@ sys/lib/dist/cmd/touchfs.c - 664 sys sys 1018469727 1120
 sys/lib/dist/cmd/unbflz.c - 664 sys sys 1018469727 1688
 sys/lib/dist/logcompress.awk - 664 sys sys 1068558028 298
 sys/lib/dist/logtime.awk - 664 sys sys 1019526213 38
-sys/lib/dist/mkfile - 664 sys sys 1168307719 5076
+sys/lib/dist/mkfile - 664 sys sys 1173736647 5154
 sys/lib/dist/pc - 20000000775 sys sys 1147022870 0
 sys/lib/dist/pc/cd0.proto - 664 sys sys 1114358485 7
 sys/lib/dist/pc/empty - 20000000775 sys sys 1020895854 0
@@ -7731,6 +7732,7 @@ sys/man/8/drawterm - 664 sys sys 1135901219 1741
 sys/man/8/fossilcons - 664 sys sys 1155362671 18291
 sys/man/8/fs - 664 sys sys 1172956177 15086
 sys/man/8/fsconfig - 664 sys sys 1172956534 8878
+sys/man/8/fshalt - 664 sys sys 1173737264 862
 sys/man/8/getflags - 664 sys sys 1159419702 1713
 sys/man/8/gpsfs - 664 sys sys 1165623047 4918
 sys/man/8/httpd - 664 sys sys 1165623004 6865
@@ -7738,7 +7740,7 @@ sys/man/8/init - 664 sys sys 944959679 1430
 sys/man/8/ipconfig - 664 sys sys 1159419702 6170
 sys/man/8/ipserv - 664 sys sys 1095862383 4375
 sys/man/8/kfscmd - 664 sys sys 1068569797 4515
-sys/man/8/listen - 664 sys sys 1164653967 3551
+sys/man/8/listen - 664 sys sys 1173736981 3562
 sys/man/8/lp - 664 sys sys 954614702 2491
 sys/man/8/mk9660 - 664 sys sys 1104430379 3946
 sys/man/8/mkfs - 664 sys sys 1163208436 3414
@@ -8680,7 +8682,7 @@ sys/src/ape/lib/ap/plan9/getpwnam.c - 664 sys sys 1014921984 507
 sys/src/ape/lib/ap/plan9/getpwuid.c - 664 sys sys 1014921984 527
 sys/src/ape/lib/ap/plan9/getuid.c - 664 sys sys 1014921984 199
 sys/src/ape/lib/ap/plan9/isatty.c - 664 sys sys 1014921984 471
-sys/src/ape/lib/ap/plan9/kill.c - 664 sys sys 1173022765 911
+sys/src/ape/lib/ap/plan9/kill.c - 664 sys sys 1173736785 912
 sys/src/ape/lib/ap/plan9/lib.h - 664 sys sys 1072835434 2071
 sys/src/ape/lib/ap/plan9/link.c - 664 sys sys 1014921984 168
 sys/src/ape/lib/ap/plan9/lseek.c - 664 sys sys 1038237526 358
@@ -8833,8 +8835,8 @@ sys/src/ape/lib/ap/stdio/vprintf.c - 664 sys sys 1014921983 134
 sys/src/ape/lib/ap/stdio/vsnprintf.c - 664 sys sys 1134052382 267
 sys/src/ape/lib/ap/stdio/vsprintf.c - 664 sys sys 1134052382 254
 sys/src/ape/lib/ap/syscall - 20000000775 sys sys 1039727535 0
-sys/src/ape/lib/ap/syscall/geninstall - 775 sys sys 1173384418 425
-sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173384418 164
+sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173737406 520
+sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173737407 489
 sys/src/ape/lib/bsd - 20000000775 sys sys 1063858406 0
 sys/src/ape/lib/bsd/_sock_ingetaddr.c - 664 sys sys 1014921994 836
 sys/src/ape/lib/bsd/_sock_ipattr.c - 664 sys sys 1014921994 577
@@ -9679,7 +9681,7 @@ sys/src/cmd/aux/gps/mkfile - 664 sys sys 1108397331 219
 sys/src/cmd/aux/gps/util.c - 664 sys sys 1107448815 2795
 sys/src/cmd/aux/lines.c - 664 sys sys 1015008782 546
 sys/src/cmd/aux/lis - 775 sys sys 944960794 45
-sys/src/cmd/aux/listen.c - 664 sys sys 1164653434 8796
+sys/src/cmd/aux/listen.c - 664 sys sys 1173736994 8997
 sys/src/cmd/aux/listen1.c - 664 sys sys 1143759349 2005
 sys/src/cmd/aux/mkfile - 664 sys sys 1147022848 1021
 sys/src/cmd/aux/mklatinkbd.c - 664 sys sys 953253425 3813
@@ -10194,7 +10196,7 @@ sys/src/cmd/fossil/build - 664 sys sys 1042005505 449
 sys/src/cmd/fossil/buildsh - 775 sys sys 1042005505 561
 sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
 sys/src/cmd/fossil/cache.c - 664 sys sys 1143759345 43875
-sys/src/cmd/fossil/check.c - 664 sys sys 1091904423 17315
+sys/src/cmd/fossil/check.c - 664 sys sys 1173736846 17436
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1084333190 1416
 sys/src/cmd/fossil/dat.h - 664 sys sys 1158373945 7622
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
@@ -10208,7 +10210,7 @@ sys/src/cmd/fossil/flchk.c - 664 sys sys 1087005592 1771
 sys/src/cmd/fossil/flfmt.c - 664 sys sys 1080586881 10753
 sys/src/cmd/fossil/flfmt9660.c - 664 sys sys 1132451844 12318
 sys/src/cmd/fossil/flfmt9660.h - 664 sys sys 1072830621 134
-sys/src/cmd/fossil/flproto - 664 sys sys 1042005508 210
+sys/src/cmd/fossil/flproto - 664 sys sys 1173736837 222
 sys/src/cmd/fossil/fns.h - 664 sys sys 1139667257 3228
 sys/src/cmd/fossil/fossil-acid - 664 sys sys 1139667278 4365
 sys/src/cmd/fossil/fossil.c - 664 sys sys 1077896345 2435
@@ -12653,7 +12655,7 @@ sys/src/cmd/mk/var.c - 664 sys sys 1131289510 530
 sys/src/cmd/mk/varsub.c - 664 sys sys 1131289511 4425
 sys/src/cmd/mk/word.c - 664 sys sys 944961025 2595
 sys/src/cmd/mkdir.c - 664 sys sys 1082593106 1026
-sys/src/cmd/mkfile - 664 sys sys 1142958953 2451
+sys/src/cmd/mkfile - 664 sys sys 1173736967 2618
 sys/src/cmd/mklib - 664 sys sys 1101213349 618
 sys/src/cmd/mkmany - 664 sys sys 1123818681 1304
 sys/src/cmd/mkone - 664 sys sys 1123943673 910
@@ -12665,28 +12667,30 @@ sys/src/cmd/mtime.c - 664 sys sys 1036172302 450
 sys/src/cmd/mug.c - 664 sys sys 1157143847 24888
 sys/src/cmd/mv.c - 664 sys sys 1163029439 4682
 sys/src/cmd/ndb - 20000000775 sys sys 1080135004 0
-sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1173059857 6856
-sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173335487 10645
-sys/src/cmd/ndb/cs.c - 664 sys sys 1163208617 33080
-sys/src/cmd/ndb/csquery.c - 664 sys sys 1173401775 1073
-sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173335538 18207
-sys/src/cmd/ndb/dn.c - 664 sys sys 1173239201 32107
-sys/src/cmd/ndb/dnarea.c - 664 sys sys 1173059947 2517
-sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1173238959 3158
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173401935 22144
-sys/src/cmd/ndb/dns.c - 664 sys sys 1173401831 15957
-sys/src/cmd/ndb/dns.h - 664 sys sys 1173335529 9992
-sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173401872 8650
-sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173335425 4431
-sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1173401783 2199
-sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173401840 7704
-sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173335517 5678
-sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711426 773
+sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1117253517 6866
+sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1060612175 7248
+sys/src/cmd/ndb/cs.c - 664 sys sys 1163208159 33080
+sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
+sys/src/cmd/ndb/dblookup.c - 664 sys sys 1143749799 18249
+sys/src/cmd/ndb/dn.acid - 664 sys sys 1144950752 20174
+sys/src/cmd/ndb/dn.c - 664 sys sys 1144952448 28763
+sys/src/cmd/ndb/dnarea.c - 664 sys sys 1121972945 2128
+sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1144952457 3066
+sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1166760846 15351
+sys/src/cmd/ndb/dns.c - 664 sys sys 1146746848 15309
+sys/src/cmd/ndb/dns.h - 664 sys sys 1144952221 10171
+sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1144952322 8492
+sys/src/cmd/ndb/dnserver.c - 664 sys sys 1143648239 3982
+sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1120564707 2198
+sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1144952355 7349
+sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1144969068 5337
+sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711423 773
 sys/src/cmd/ndb/mkdb.c - 664 sys sys 957402054 2886
-sys/src/cmd/ndb/mkfile - 664 sys sys 1173059600 1984
+sys/src/cmd/ndb/mkfile - 664 sys sys 1055701930 1877
 sys/src/cmd/ndb/mkhash.c - 664 sys sys 1014926160 2899
 sys/src/cmd/ndb/mkhosts.c - 664 sys sys 957402054 4294
-sys/src/cmd/ndb/query.c - 664 sys sys 1173239042 1137
+sys/src/cmd/ndb/query.c - 664 sys sys 1078782843 1120
+sys/src/cmd/ndb/time.c - 664 sys sys 957402055 321
 sys/src/cmd/netstat.c - 664 sys sys 1128255434 4086
 sys/src/cmd/news.c - 664 sys sys 1014926614 3778
 sys/src/cmd/nfs.c - 664 sys sys 1050068720 31096
@@ -14370,7 +14374,7 @@ sys/src/fs/dev - 20000000775 sys sys 1140168396 0
 sys/src/fs/dev/apc.c - 664 sys sys 1140167918 14910
 sys/src/fs/dev/cw.c - 664 sys sys 1097712558 43252
 sys/src/fs/dev/fworm.c - 664 sys sys 1140167912 1845
-sys/src/fs/dev/juke.c - 664 sys sys 1097578476 22885
+sys/src/fs/dev/juke.c - 664 sys sys 1173736142 22905
 sys/src/fs/dev/mkfile - 664 sys sys 1015109974 132
 sys/src/fs/dev/mworm.c - 664 sys sys 1140167915 4264
 sys/src/fs/dev/wren.c - 664 sys sys 1140167916 2392
@@ -14440,7 +14444,7 @@ sys/src/fs/pc/ethermii.h - 664 sys sys 1140167955 3259
 sys/src/fs/pc/floppy.c - 664 sys sys 1097579636 14022
 sys/src/fs/pc/kbd.c - 664 sys sys 1015110060 6030
 sys/src/fs/pc/l.s - 664 sys sys 1096008336 10838
-sys/src/fs/pc/lock.c - 664 sys sys 1045502910 3591
+sys/src/fs/pc/lock.c - 664 sys sys 1173736177 3672
 sys/src/fs/pc/malloc.c - 664 sys sys 1096789023 2840
 sys/src/fs/pc/mkfile - 664 sys sys 1140167942 426
 sys/src/fs/pc/mmu.c - 664 sys sys 1015110065 8414
@@ -14465,7 +14469,7 @@ sys/src/fs/port/all.h - 664 sys sys 1146798594 1888
 sys/src/fs/port/auth.c - 664 sys sys 1146785221 7606
 sys/src/fs/port/chk.c - 664 sys sys 1097832483 15683
 sys/src/fs/port/clock.c - 664 sys sys 1097580538 4033
-sys/src/fs/port/con.c - 664 sys sys 1146785256 16304
+sys/src/fs/port/con.c - 664 sys sys 1173736129 16296
 sys/src/fs/port/config.c - 664 sys sys 1157944410 20574
 sys/src/fs/port/console.c - 664 sys sys 1101627646 4886
 sys/src/fs/port/data.c - 664 sys sys 1140167986 4510
@@ -14485,7 +14489,7 @@ sys/src/fs/port/print.c - 664 sys sys 1015110022 153
 sys/src/fs/port/proc.c - 664 sys sys 1097580775 5364
 sys/src/fs/port/sd.h - 664 sys sys 1140774087 2305
 sys/src/fs/port/sub.c - 664 sys sys 1151380380 25860
-sys/src/fs/port/time.c - 664 sys sys 1140167998 6222
+sys/src/fs/port/time.c - 664 sys sys 1173736121 6443
 sys/src/fs/port/uidgid.c - 664 sys sys 1097574050 9192
 sys/src/games - 20000000775 sys sys 1128271724 0
 sys/src/games/4s.c - 664 sys sys 1128271724 1285
@@ -14828,7 +14832,7 @@ sys/src/libc/9sys/werrstr.c - 664 sys sys 1014927340 196
 sys/src/libc/9sys/write.c - 664 sys sys 1014927340 110
 sys/src/libc/9sys/writev.c - 664 sys sys 1014927340 577
 sys/src/libc/9syscall - 20000000775 sys sys 1062619381 0
-sys/src/libc/9syscall/mkfile - 664 sys sys 1173374403 2891
+sys/src/libc/9syscall/mkfile - 664 sys sys 1173737379 2800
 sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
 sys/src/libc/alpha - 20000000775 sys sys 1067718982 0
 sys/src/libc/alpha/_seek.c - 664 sys sys 1130424714 180
@@ -15423,7 +15427,7 @@ sys/src/libndb/ndbhash.c - 664 sys sys 1144174490 5276
 sys/src/libndb/ndbhf.h - 664 sys sys 1015013485 746
 sys/src/libndb/ndbipinfo.c - 664 sys sys 1157899101 5127
 sys/src/libndb/ndblookval.c - 664 sys sys 1078839929 791
-sys/src/libndb/ndbopen.c - 664 sys sys 1069206441 2716
+sys/src/libndb/ndbopen.c - 664 sys sys 1173737251 2717
 sys/src/libndb/ndbparse.c - 664 sys sys 1144174490 1207
 sys/src/libndb/ndbreorder.c - 664 sys sys 1078618600 966
 sys/src/libndb/ndbsubstitute.c - 664 sys sys 1144174491 867
@@ -15682,6 +15686,3 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173413221 383
-sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173413222 351
-sys/src/ape/lib/ap/syscall/geninstall xxx REMOVED xxx xxx 0 0

+ 66 - 62
dist/replica/plan9.db

@@ -22,21 +22,21 @@
 386/bin/acid - 775 sys sys 1172808055 401961
 386/bin/acme - 775 sys sys 1168402263 432256
 386/bin/ape - 20000000775 sys sys 1016944144 0
-386/bin/ape/basename - 775 sys sys 1173039777 134719
+386/bin/ape/basename - 775 sys sys 1173754547 134719
 386/bin/ape/cc - 775 sys sys 1168402263 70642
-386/bin/ape/diff - 775 sys sys 1173039778 352264
-386/bin/ape/diff3 - 775 sys sys 1173039779 190364
-386/bin/ape/dirname - 775 sys sys 1173039779 134498
-386/bin/ape/expr - 775 sys sys 1173039780 144138
-386/bin/ape/kill - 775 sys sys 1173039781 140067
-386/bin/ape/make - 775 sys sys 1173039781 211605
-386/bin/ape/patch - 775 sys sys 1173039782 305848
+386/bin/ape/diff - 775 sys sys 1173754548 352264
+386/bin/ape/diff3 - 775 sys sys 1173754549 190364
+386/bin/ape/dirname - 775 sys sys 1173754549 134498
+386/bin/ape/expr - 775 sys sys 1173754549 144138
+386/bin/ape/kill - 775 sys sys 1173754550 140067
+386/bin/ape/make - 775 sys sys 1173754550 211605
+386/bin/ape/patch - 775 sys sys 1173754551 305848
 386/bin/ape/psh - 775 sys sys 1042220689 34
-386/bin/ape/sed - 775 sys sys 1173039783 160183
-386/bin/ape/sh - 775 sys sys 1173039783 481732
+386/bin/ape/sed - 775 sys sys 1173754551 160183
+386/bin/ape/sh - 775 sys sys 1173754552 481732
 386/bin/ape/stty - 775 sys sys 1148500571 41080
 386/bin/ape/tar - 775 sys sys 1168402264 62184
-386/bin/ape/uname - 775 sys sys 1173039784 134895
+386/bin/ape/uname - 775 sys sys 1173754552 134895
 386/bin/aquarela - 775 sys sys 1169612017 332788
 386/bin/ar - 775 sys sys 1168402265 113774
 386/bin/archfs - 775 sys sys 1168402265 147070
@@ -108,10 +108,10 @@
 386/bin/aux/hardcopy - 775 sys sys 1020319063 1699
 386/bin/aux/isvmware - 775 sys sys 1032486791 23997
 386/bin/aux/lines - 775 sys sys 1168402281 60716
-386/bin/aux/listen - 775 sys sys 1168402281 108803
+386/bin/aux/listen - 775 sys sys 1173754552 108570
 386/bin/aux/listen1 - 775 sys sys 1168402281 94721
-386/bin/aux/lpdaemon - 775 sys sys 1173039785 170710
-386/bin/aux/lpdsend - 775 sys sys 1173039785 157339
+386/bin/aux/lpdaemon - 775 sys sys 1173754553 170710
+386/bin/aux/lpdsend - 775 sys sys 1173754553 157339
 386/bin/aux/lpsend - 775 sys sys 1148500596 52590
 386/bin/aux/mapd - 775 sys sys 1168402282 191082
 386/bin/aux/mkflashfs - 775 sys sys 1168402282 67590
@@ -157,7 +157,7 @@
 386/bin/aux/write - 775 sys sys 1085077011 4188
 386/bin/aux/zerotrunc - 775 sys sys 1108268388 3891
 386/bin/awd - 775 sys sys 1168402289 58975
-386/bin/awk - 775 sys sys 1173039786 324980
+386/bin/awk - 775 sys sys 1173754554 324980
 386/bin/basename - 775 sys sys 1148500606 37919
 386/bin/bc - 775 sys sys 1168402290 82001
 386/bin/bind - 775 sys sys 1168402290 59805
@@ -186,7 +186,7 @@
 386/bin/col - 775 sys sys 1172029864 64995
 386/bin/colors - 775 sys sys 1168402296 150967
 386/bin/comm - 775 sys sys 1168402296 61586
-386/bin/compress - 775 sys sys 1173039787 166944
+386/bin/compress - 775 sys sys 1173754554 166944
 386/bin/con - 775 sys sys 1168402297 78486
 386/bin/cp - 775 sys sys 1168402297 63454
 386/bin/cpp - 775 sys sys 1168402297 150459
@@ -223,7 +223,7 @@
 386/bin/du - 775 sys sys 1168402304 74244
 386/bin/echo - 775 sys sys 1168402304 57592
 386/bin/ed - 775 sys sys 1168402304 93272
-386/bin/eqn - 775 sys sys 1173039787 244858
+386/bin/eqn - 775 sys sys 1173754555 244858
 386/bin/execnet - 775 sys sys 1168402305 178216
 386/bin/exportfs - 775 sys sys 1168402305 162550
 386/bin/ext2srv - 775 sys sys 1168402306 179893
@@ -235,9 +235,9 @@
 386/bin/fortune - 775 sys sys 1168402308 67356
 386/bin/fossil - 20000000775 sys sys 1042005470 0
 386/bin/fossil/conf - 775 sys sys 1085077052 1506
-386/bin/fossil/flchk - 775 sys sys 1168402308 239004
+386/bin/fossil/flchk - 775 sys sys 1173754556 239100
 386/bin/fossil/flfmt - 775 sys sys 1168402309 247151
-386/bin/fossil/fossil - 775 sys sys 1168402310 364442
+386/bin/fossil/fossil - 775 sys sys 1173754557 364538
 386/bin/fossil/last - 775 sys sys 1168402310 63550
 386/bin/freq - 775 sys sys 1168402310 62040
 386/bin/fs - 20000000775 sys sys 954380769 0
@@ -264,10 +264,10 @@
 386/bin/games/sudoku - 775 sys sys 1117249746 171666
 386/bin/getmap - 775 sys sys 1168402311 65423
 386/bin/gif - 775 sys sys 1168402312 158555
-386/bin/grap - 775 sys sys 1173039788 282722
+386/bin/grap - 775 sys sys 1173754557 282722
 386/bin/graph - 775 sys sys 1168402312 129250
 386/bin/grep - 775 sys sys 1168402312 79569
-386/bin/gs - 775 sys sys 1173039815 13278932
+386/bin/gs - 775 sys sys 1173754582 13278932
 386/bin/gunzip - 775 sys sys 1168402313 80523
 386/bin/gview - 775 sys sys 1168402313 238983
 386/bin/gzip - 775 sys sys 1168402313 84984
@@ -534,7 +534,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 1070519112 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1173410635 783116
+386/lib/ape/libap.a - 664 sys sys 1173754584 819938
 386/lib/ape/libbsd.a - 664 sys sys 1146156978 183900
 386/lib/ape/libdraw.a - 664 sys sys 1155491760 621772
 386/lib/ape/libfmt.a - 664 sys sys 1146156980 156706
@@ -1396,7 +1396,7 @@ lib/face/48x48x4/x/xigh.1 - 664 sys sys 1142019024 1204
 lib/face/48x48x4/y - 20000000775 sys sys 1020895714 0
 lib/face/48x48x4/z - 20000000775 sys sys 1020895714 0
 lib/face/48x48x8 - 20000000775 sys sys 1123100641 0
-lib/face/48x48x8/.dict - 664 sys sys 1172265593 2972
+lib/face/48x48x8/.dict - 664 sys sys 1173737462 3000
 lib/face/48x48x8/Z - 20000000775 sys sys 1020895714 0
 lib/face/48x48x8/a - 20000000775 sys sys 1056983599 0
 lib/face/48x48x8/a/alu.1 - 664 sys sys 1172265619 1719
@@ -1415,6 +1415,7 @@ lib/face/48x48x8/e - 20000000775 sys sys 1155331573 0
 lib/face/48x48x8/e/ericvh.2 - 664 sys sys 1155331573 1049
 lib/face/48x48x8/f - 20000000775 sys sys 1155331586 0
 lib/face/48x48x8/f/faa.1 - 664 sys sys 1172265611 2013
+lib/face/48x48x8/f/fgb.1 - 664 sys sys 1173737473 2966
 lib/face/48x48x8/f/forsyth.1 - 664 sys sys 1056982111 1864
 lib/face/48x48x8/f/fst.1 - 664 sys sys 1157149515 1099
 lib/face/48x48x8/g - 20000000775 sys sys 1140276024 0
@@ -5227,7 +5228,7 @@ lib/tftpd - 20000000775 sys sys 1020895767 0
 lib/unicode - 664 sys sys 958440028 223312
 lib/unicode.notice - 664 sys sys 958504386 1398
 lib/units - 664 sys sys 1071415518 9997
-lib/vgadb - 664 sys sys 1170456084 30303
+lib/vgadb - 664 sys sys 1173737426 30457
 lib/volcanoes - 664 sys sys 944944024 119831
 lib/words - 664 sys sys 1014923442 247097
 lp - 20000000775 sys sys 1079376135 0
@@ -5450,7 +5451,7 @@ rc/bin/dosmnt - 775 sys sys 1109288224 303
 rc/bin/eject - 775 sys sys 945617207 123
 rc/bin/fax - 775 sys sys 1127394677 2385
 rc/bin/fedex - 775 sys sys 1060187356 1244
-rc/bin/fshalt - 775 sys sys 1169491261 1401
+rc/bin/fshalt - 775 sys sys 1173737783 1652
 rc/bin/homespool - 775 sys sys 945617207 339
 rc/bin/ipconf - 20000000775 sys sys 1058791152 0
 rc/bin/ipconf/inside - 775 sys sys 1058790955 427
@@ -5462,13 +5463,13 @@ rc/bin/iwhois - 775 sys sys 1143979502 1637
 rc/bin/juke - 775 sys sys 1105565140 1131
 rc/bin/kill - 775 sys sys 1143389260 142
 rc/bin/kmem - 775 sys sys 1141940177 468
-rc/bin/label - 775 sys sys 1173121903 113
+rc/bin/label - 775 sys sys 1173737765 189
 rc/bin/lc - 775 sys sys 945617207 24
 rc/bin/leak - 775 sys sys 1172760642 1921
 rc/bin/lookman - 775 sys sys 1017679344 686
 rc/bin/lp - 775 sys sys 1162105982 5201
 rc/bin/mail - 775 sys sys 1045504003 138
-rc/bin/man - 775 sys sys 1172005212 2494
+rc/bin/man - 775 sys sys 1173755398 2504
 rc/bin/map - 775 sys sys 945617207 1576
 rc/bin/mapdemo - 775 sys sys 945617207 4075
 rc/bin/membername - 775 sys sys 945617207 89
@@ -5768,7 +5769,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1173279478 263737
+sys/games/lib/fortunes - 664 sys sys 1173736758 264000
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -6142,7 +6143,7 @@ sys/lib/dist/cmd/touchfs.c - 664 sys sys 1018469727 1120
 sys/lib/dist/cmd/unbflz.c - 664 sys sys 1018469727 1688
 sys/lib/dist/logcompress.awk - 664 sys sys 1068558028 298
 sys/lib/dist/logtime.awk - 664 sys sys 1019526213 38
-sys/lib/dist/mkfile - 664 sys sys 1168307719 5076
+sys/lib/dist/mkfile - 664 sys sys 1173736647 5154
 sys/lib/dist/pc - 20000000775 sys sys 1147022870 0
 sys/lib/dist/pc/cd0.proto - 664 sys sys 1114358485 7
 sys/lib/dist/pc/empty - 20000000775 sys sys 1020895854 0
@@ -7731,6 +7732,7 @@ sys/man/8/drawterm - 664 sys sys 1135901219 1741
 sys/man/8/fossilcons - 664 sys sys 1155362671 18291
 sys/man/8/fs - 664 sys sys 1172956177 15086
 sys/man/8/fsconfig - 664 sys sys 1172956534 8878
+sys/man/8/fshalt - 664 sys sys 1173737264 862
 sys/man/8/getflags - 664 sys sys 1159419702 1713
 sys/man/8/gpsfs - 664 sys sys 1165623047 4918
 sys/man/8/httpd - 664 sys sys 1165623004 6865
@@ -7738,7 +7740,7 @@ sys/man/8/init - 664 sys sys 944959679 1430
 sys/man/8/ipconfig - 664 sys sys 1159419702 6170
 sys/man/8/ipserv - 664 sys sys 1095862383 4375
 sys/man/8/kfscmd - 664 sys sys 1068569797 4515
-sys/man/8/listen - 664 sys sys 1164653967 3551
+sys/man/8/listen - 664 sys sys 1173736981 3562
 sys/man/8/lp - 664 sys sys 954614702 2491
 sys/man/8/mk9660 - 664 sys sys 1104430379 3946
 sys/man/8/mkfs - 664 sys sys 1163208436 3414
@@ -8680,7 +8682,7 @@ sys/src/ape/lib/ap/plan9/getpwnam.c - 664 sys sys 1014921984 507
 sys/src/ape/lib/ap/plan9/getpwuid.c - 664 sys sys 1014921984 527
 sys/src/ape/lib/ap/plan9/getuid.c - 664 sys sys 1014921984 199
 sys/src/ape/lib/ap/plan9/isatty.c - 664 sys sys 1014921984 471
-sys/src/ape/lib/ap/plan9/kill.c - 664 sys sys 1173022765 911
+sys/src/ape/lib/ap/plan9/kill.c - 664 sys sys 1173736785 912
 sys/src/ape/lib/ap/plan9/lib.h - 664 sys sys 1072835434 2071
 sys/src/ape/lib/ap/plan9/link.c - 664 sys sys 1014921984 168
 sys/src/ape/lib/ap/plan9/lseek.c - 664 sys sys 1038237526 358
@@ -8833,8 +8835,8 @@ sys/src/ape/lib/ap/stdio/vprintf.c - 664 sys sys 1014921983 134
 sys/src/ape/lib/ap/stdio/vsnprintf.c - 664 sys sys 1134052382 267
 sys/src/ape/lib/ap/stdio/vsprintf.c - 664 sys sys 1134052382 254
 sys/src/ape/lib/ap/syscall - 20000000775 sys sys 1039727535 0
-sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173413221 383
-sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173413222 351
+sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173737406 520
+sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173737407 489
 sys/src/ape/lib/bsd - 20000000775 sys sys 1063858406 0
 sys/src/ape/lib/bsd/_sock_ingetaddr.c - 664 sys sys 1014921994 836
 sys/src/ape/lib/bsd/_sock_ipattr.c - 664 sys sys 1014921994 577
@@ -9679,7 +9681,7 @@ sys/src/cmd/aux/gps/mkfile - 664 sys sys 1108397331 219
 sys/src/cmd/aux/gps/util.c - 664 sys sys 1107448815 2795
 sys/src/cmd/aux/lines.c - 664 sys sys 1015008782 546
 sys/src/cmd/aux/lis - 775 sys sys 944960794 45
-sys/src/cmd/aux/listen.c - 664 sys sys 1164653434 8796
+sys/src/cmd/aux/listen.c - 664 sys sys 1173736994 8997
 sys/src/cmd/aux/listen1.c - 664 sys sys 1143759349 2005
 sys/src/cmd/aux/mkfile - 664 sys sys 1147022848 1021
 sys/src/cmd/aux/mklatinkbd.c - 664 sys sys 953253425 3813
@@ -10194,7 +10196,7 @@ sys/src/cmd/fossil/build - 664 sys sys 1042005505 449
 sys/src/cmd/fossil/buildsh - 775 sys sys 1042005505 561
 sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
 sys/src/cmd/fossil/cache.c - 664 sys sys 1143759345 43875
-sys/src/cmd/fossil/check.c - 664 sys sys 1091904423 17315
+sys/src/cmd/fossil/check.c - 664 sys sys 1173736846 17436
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1084333190 1416
 sys/src/cmd/fossil/dat.h - 664 sys sys 1158373945 7622
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
@@ -10208,7 +10210,7 @@ sys/src/cmd/fossil/flchk.c - 664 sys sys 1087005592 1771
 sys/src/cmd/fossil/flfmt.c - 664 sys sys 1080586881 10753
 sys/src/cmd/fossil/flfmt9660.c - 664 sys sys 1132451844 12318
 sys/src/cmd/fossil/flfmt9660.h - 664 sys sys 1072830621 134
-sys/src/cmd/fossil/flproto - 664 sys sys 1042005508 210
+sys/src/cmd/fossil/flproto - 664 sys sys 1173736837 222
 sys/src/cmd/fossil/fns.h - 664 sys sys 1139667257 3228
 sys/src/cmd/fossil/fossil-acid - 664 sys sys 1139667278 4365
 sys/src/cmd/fossil/fossil.c - 664 sys sys 1077896345 2435
@@ -12653,7 +12655,7 @@ sys/src/cmd/mk/var.c - 664 sys sys 1131289510 530
 sys/src/cmd/mk/varsub.c - 664 sys sys 1131289511 4425
 sys/src/cmd/mk/word.c - 664 sys sys 944961025 2595
 sys/src/cmd/mkdir.c - 664 sys sys 1082593106 1026
-sys/src/cmd/mkfile - 664 sys sys 1142958953 2451
+sys/src/cmd/mkfile - 664 sys sys 1173736967 2618
 sys/src/cmd/mklib - 664 sys sys 1101213349 618
 sys/src/cmd/mkmany - 664 sys sys 1123818681 1304
 sys/src/cmd/mkone - 664 sys sys 1123943673 910
@@ -12665,28 +12667,30 @@ sys/src/cmd/mtime.c - 664 sys sys 1036172302 450
 sys/src/cmd/mug.c - 664 sys sys 1157143847 24888
 sys/src/cmd/mv.c - 664 sys sys 1163029439 4682
 sys/src/cmd/ndb - 20000000775 sys sys 1080135004 0
-sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1173059857 6856
-sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173335487 10645
-sys/src/cmd/ndb/cs.c - 664 sys sys 1163208617 33080
-sys/src/cmd/ndb/csquery.c - 664 sys sys 1173401775 1073
-sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173335538 18207
-sys/src/cmd/ndb/dn.c - 664 sys sys 1173239201 32107
-sys/src/cmd/ndb/dnarea.c - 664 sys sys 1173059947 2517
-sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1173238959 3158
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173401935 22144
-sys/src/cmd/ndb/dns.c - 664 sys sys 1173401831 15957
-sys/src/cmd/ndb/dns.h - 664 sys sys 1173335529 9992
-sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173401872 8650
-sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173335425 4431
-sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1173401783 2199
-sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173401840 7704
-sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173335517 5678
-sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711426 773
+sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1117253517 6866
+sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1060612175 7248
+sys/src/cmd/ndb/cs.c - 664 sys sys 1163208159 33080
+sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
+sys/src/cmd/ndb/dblookup.c - 664 sys sys 1143749799 18249
+sys/src/cmd/ndb/dn.acid - 664 sys sys 1144950752 20174
+sys/src/cmd/ndb/dn.c - 664 sys sys 1144952448 28763
+sys/src/cmd/ndb/dnarea.c - 664 sys sys 1121972945 2128
+sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1144952457 3066
+sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1166760846 15351
+sys/src/cmd/ndb/dns.c - 664 sys sys 1146746848 15309
+sys/src/cmd/ndb/dns.h - 664 sys sys 1144952221 10171
+sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1144952322 8492
+sys/src/cmd/ndb/dnserver.c - 664 sys sys 1143648239 3982
+sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1120564707 2198
+sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1144952355 7349
+sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1144969068 5337
+sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711423 773
 sys/src/cmd/ndb/mkdb.c - 664 sys sys 957402054 2886
-sys/src/cmd/ndb/mkfile - 664 sys sys 1173059600 1984
+sys/src/cmd/ndb/mkfile - 664 sys sys 1055701930 1877
 sys/src/cmd/ndb/mkhash.c - 664 sys sys 1014926160 2899
 sys/src/cmd/ndb/mkhosts.c - 664 sys sys 957402054 4294
-sys/src/cmd/ndb/query.c - 664 sys sys 1173239042 1137
+sys/src/cmd/ndb/query.c - 664 sys sys 1078782843 1120
+sys/src/cmd/ndb/time.c - 664 sys sys 957402055 321
 sys/src/cmd/netstat.c - 664 sys sys 1128255434 4086
 sys/src/cmd/news.c - 664 sys sys 1014926614 3778
 sys/src/cmd/nfs.c - 664 sys sys 1050068720 31096
@@ -14370,7 +14374,7 @@ sys/src/fs/dev - 20000000775 sys sys 1140168396 0
 sys/src/fs/dev/apc.c - 664 sys sys 1140167918 14910
 sys/src/fs/dev/cw.c - 664 sys sys 1097712558 43252
 sys/src/fs/dev/fworm.c - 664 sys sys 1140167912 1845
-sys/src/fs/dev/juke.c - 664 sys sys 1097578476 22885
+sys/src/fs/dev/juke.c - 664 sys sys 1173736142 22905
 sys/src/fs/dev/mkfile - 664 sys sys 1015109974 132
 sys/src/fs/dev/mworm.c - 664 sys sys 1140167915 4264
 sys/src/fs/dev/wren.c - 664 sys sys 1140167916 2392
@@ -14440,7 +14444,7 @@ sys/src/fs/pc/ethermii.h - 664 sys sys 1140167955 3259
 sys/src/fs/pc/floppy.c - 664 sys sys 1097579636 14022
 sys/src/fs/pc/kbd.c - 664 sys sys 1015110060 6030
 sys/src/fs/pc/l.s - 664 sys sys 1096008336 10838
-sys/src/fs/pc/lock.c - 664 sys sys 1045502910 3591
+sys/src/fs/pc/lock.c - 664 sys sys 1173736177 3672
 sys/src/fs/pc/malloc.c - 664 sys sys 1096789023 2840
 sys/src/fs/pc/mkfile - 664 sys sys 1140167942 426
 sys/src/fs/pc/mmu.c - 664 sys sys 1015110065 8414
@@ -14465,7 +14469,7 @@ sys/src/fs/port/all.h - 664 sys sys 1146798594 1888
 sys/src/fs/port/auth.c - 664 sys sys 1146785221 7606
 sys/src/fs/port/chk.c - 664 sys sys 1097832483 15683
 sys/src/fs/port/clock.c - 664 sys sys 1097580538 4033
-sys/src/fs/port/con.c - 664 sys sys 1146785256 16304
+sys/src/fs/port/con.c - 664 sys sys 1173736129 16296
 sys/src/fs/port/config.c - 664 sys sys 1157944410 20574
 sys/src/fs/port/console.c - 664 sys sys 1101627646 4886
 sys/src/fs/port/data.c - 664 sys sys 1140167986 4510
@@ -14485,7 +14489,7 @@ sys/src/fs/port/print.c - 664 sys sys 1015110022 153
 sys/src/fs/port/proc.c - 664 sys sys 1097580775 5364
 sys/src/fs/port/sd.h - 664 sys sys 1140774087 2305
 sys/src/fs/port/sub.c - 664 sys sys 1151380380 25860
-sys/src/fs/port/time.c - 664 sys sys 1140167998 6222
+sys/src/fs/port/time.c - 664 sys sys 1173736121 6443
 sys/src/fs/port/uidgid.c - 664 sys sys 1097574050 9192
 sys/src/games - 20000000775 sys sys 1128271724 0
 sys/src/games/4s.c - 664 sys sys 1128271724 1285
@@ -14828,7 +14832,7 @@ sys/src/libc/9sys/werrstr.c - 664 sys sys 1014927340 196
 sys/src/libc/9sys/write.c - 664 sys sys 1014927340 110
 sys/src/libc/9sys/writev.c - 664 sys sys 1014927340 577
 sys/src/libc/9syscall - 20000000775 sys sys 1062619381 0
-sys/src/libc/9syscall/mkfile - 664 sys sys 1173374403 2891
+sys/src/libc/9syscall/mkfile - 664 sys sys 1173737379 2800
 sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
 sys/src/libc/alpha - 20000000775 sys sys 1067718982 0
 sys/src/libc/alpha/_seek.c - 664 sys sys 1130424714 180
@@ -15423,7 +15427,7 @@ sys/src/libndb/ndbhash.c - 664 sys sys 1144174490 5276
 sys/src/libndb/ndbhf.h - 664 sys sys 1015013485 746
 sys/src/libndb/ndbipinfo.c - 664 sys sys 1157899101 5127
 sys/src/libndb/ndblookval.c - 664 sys sys 1078839929 791
-sys/src/libndb/ndbopen.c - 664 sys sys 1069206441 2716
+sys/src/libndb/ndbopen.c - 664 sys sys 1173737251 2717
 sys/src/libndb/ndbparse.c - 664 sys sys 1144174490 1207
 sys/src/libndb/ndbreorder.c - 664 sys sys 1078618600 966
 sys/src/libndb/ndbsubstitute.c - 664 sys sys 1144174491 867

+ 66 - 0
dist/replica/plan9.log

@@ -47806,3 +47806,69 @@
 1173414606 0 a sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173413221 383
 1173414606 1 c sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173413222 351
 1173414606 2 d sys/src/ape/lib/ap/syscall/geninstall - 775 sys sys 1173384418 0
+1173736806 0 c sys/games/lib/fortunes - 664 sys sys 1173736758 264000
+1173736806 1 c sys/lib/dist/mkfile - 664 sys sys 1173736647 5154
+1173736806 2 c sys/src/ape/lib/ap/plan9/kill.c - 664 sys sys 1173736785 912
+1173736806 3 c sys/src/cmd/fossil/check.c - 664 sys sys 1173736846 17436
+1173736806 4 c sys/src/cmd/fossil/flproto - 664 sys sys 1173736837 222
+1173736806 5 c sys/src/fs/dev/juke.c - 664 sys sys 1173736142 22905
+1173736806 6 c sys/src/fs/pc/lock.c - 664 sys sys 1173736177 3672
+1173736806 7 c sys/src/fs/port/con.c - 664 sys sys 1173736129 16296
+1173736806 8 c sys/src/fs/port/time.c - 664 sys sys 1173736121 6443
+1173738606 0 c lib/face/48x48x8/.dict - 664 sys sys 1173737462 3000
+1173738606 1 a lib/face/48x48x8/f/fgb.1 - 664 sys sys 1173737473 2966
+1173738606 2 c lib/vgadb - 664 sys sys 1173737426 30457
+1173738606 3 c rc/bin/fshalt - 775 sys sys 1173737783 1652
+1173738606 4 c rc/bin/label - 775 sys sys 1173737765 189
+1173738606 5 a sys/man/8/fshalt - 664 sys sys 1173737264 862
+1173738606 6 c sys/man/8/listen - 664 sys sys 1173736981 3562
+1173738606 7 c sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173737406 520
+1173738606 8 c sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173737407 489
+1173738606 9 c sys/src/cmd/aux/listen.c - 664 sys sys 1173736994 8997
+1173738606 10 c sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1117253517 6866
+1173738606 11 c sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1060612175 7248
+1173738606 12 c sys/src/cmd/ndb/cs.c - 664 sys sys 1163208159 33080
+1173738606 13 c sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
+1173738606 14 c sys/src/cmd/ndb/dblookup.c - 664 sys sys 1143749799 18249
+1173738606 15 a sys/src/cmd/ndb/dn.acid - 664 sys sys 1144950752 20174
+1173738606 16 c sys/src/cmd/ndb/dn.c - 664 sys sys 1144952448 28763
+1173738606 17 c sys/src/cmd/ndb/dnarea.c - 664 sys sys 1121972945 2128
+1173738606 18 c sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1144952457 3066
+1173738606 19 c sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1166760846 15351
+1173738606 20 c sys/src/cmd/ndb/dns.c - 664 sys sys 1146746848 15309
+1173738606 21 c sys/src/cmd/ndb/dns.h - 664 sys sys 1144952221 10171
+1173738606 22 c sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1144952322 8492
+1173738606 23 c sys/src/cmd/ndb/dnserver.c - 664 sys sys 1143648239 3982
+1173738606 24 c sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1120564707 2198
+1173738606 25 c sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1144952355 7349
+1173738606 26 c sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1144969068 5337
+1173738606 27 c sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711423 773
+1173738606 28 c sys/src/cmd/ndb/mkfile - 664 sys sys 1055701930 1877
+1173738606 29 c sys/src/cmd/ndb/query.c - 664 sys sys 1078782843 1120
+1173738606 30 a sys/src/cmd/ndb/time.c - 664 sys sys 957402055 321
+1173738606 31 c sys/src/cmd/mkfile - 664 sys sys 1173736967 2618
+1173738606 32 c sys/src/libc/9syscall/mkfile - 664 sys sys 1173737379 2800
+1173738606 33 c sys/src/libndb/ndbopen.c - 664 sys sys 1173737251 2717
+1173754806 0 c 386/bin/awk - 775 sys sys 1173754554 324980
+1173754806 1 c 386/bin/eqn - 775 sys sys 1173754555 244858
+1173754806 2 c 386/bin/grap - 775 sys sys 1173754557 282722
+1173754806 3 c 386/bin/gs - 775 sys sys 1173754582 13278932
+1173754806 4 c 386/bin/ape/basename - 775 sys sys 1173754547 134719
+1173754806 5 c 386/bin/ape/diff - 775 sys sys 1173754548 352264
+1173754806 6 c 386/bin/ape/diff3 - 775 sys sys 1173754549 190364
+1173754806 7 c 386/bin/ape/dirname - 775 sys sys 1173754549 134498
+1173754806 8 c 386/bin/ape/expr - 775 sys sys 1173754549 144138
+1173754806 9 c 386/bin/ape/kill - 775 sys sys 1173754550 140067
+1173754806 10 c 386/bin/ape/make - 775 sys sys 1173754550 211605
+1173754806 11 c 386/bin/ape/patch - 775 sys sys 1173754551 305848
+1173754806 12 c 386/bin/ape/sed - 775 sys sys 1173754551 160183
+1173754806 13 c 386/bin/ape/sh - 775 sys sys 1173754552 481732
+1173754806 14 c 386/bin/ape/uname - 775 sys sys 1173754552 134895
+1173754806 15 c 386/bin/aux/listen - 775 sys sys 1173754552 108570
+1173754806 16 c 386/bin/aux/lpdaemon - 775 sys sys 1173754553 170710
+1173754806 17 c 386/bin/aux/lpdsend - 775 sys sys 1173754553 157339
+1173754806 18 c 386/bin/compress - 775 sys sys 1173754554 166944
+1173754806 19 c 386/bin/fossil/flchk - 775 sys sys 1173754556 239100
+1173754806 20 c 386/bin/fossil/fossil - 775 sys sys 1173754557 364538
+1173754806 21 c 386/lib/ape/libap.a - 664 sys sys 1173754584 819938
+1173756606 0 c rc/bin/man - 775 sys sys 1173755398 2504

+ 1 - 0
lib/face/48x48x8/.dict

@@ -38,6 +38,7 @@ fi/unknown u/unknown.fi
 flowerbed.dyndns.org/zfolkerts z/zfolkerts.1
 fr/unknown u/unknown.fr
 france3.fr/boyd b/boyd.1
+gmail.com/benavento f/fgb.1
 gmail.com/bruce.ellis b/brucee.1
 gmail.com/ericvh e/ericvh.2
 gmail.com/joelcsalomon c/chesky.1

BIN
lib/face/48x48x8/f/fgb.1


+ 10 - 0
lib/vgadb

@@ -584,6 +584,7 @@ multisync=1280x1024i
 multisync=1376x1024
 	include=1376x1024
 
+
 #
 # Dell VS17X
 #
@@ -980,6 +981,15 @@ sm753DF=1024x768
 	vrs=769 vre=772 vt=808
 	hsync=+ vsync=+
 
+# Samsung SyncMaster 931BW
+sm931bw=1440x900
+	videobw=130
+	defaultclock=60
+	shb=1520 ehb=1672 ht=1904
+	shs=1520
+	vrs=903 vre=909 vt=934
+	hsync=-	vsync=+
+
 #
 # Sony CPD-1304
 # Horizontal timing:

+ 19 - 2
rc/bin/fshalt

@@ -1,9 +1,21 @@
 #!/bin/rc
-# halt - sync (flush) and, if possible, halt all file servers
+# fshalt [-r] - sync (flush) and, if possible, halt all file servers
+#	and optionally reboot
 rfork e
+reboot=no
+switch ($#*) {
+case 0
+case 1
+	reboot=yes
+case *
+	echo usage: $0 '[-r]' >[1=2]
+	exit usage
+}
+
 path=(/bin)
 builtin cd /
 
+unmount /mnt/consoles >[2]/dev/null
 kill consolefs | rc			# don't compete with /mnt/consoles
 sleep 1
 
@@ -75,7 +87,12 @@ fn x {
 		}
 	}
 	echo
-	echo done
+	echo done halting
+
+	if (~ $reboot yes) {
+		echo rebooting...
+		echo reboot >'#c/reboot'
+	}
 }
 
 x

+ 3 - 1
rc/bin/label

@@ -1,4 +1,6 @@
 #!/bin/rc
 # label word ... - write words into our label, if any
-if (test -e /dev/label)
+if (test -w /dev/label)
 	echo -n $* > /dev/label
+if not if (test -w   /mnt/term/dev/label)
+	echo -n $* > /mnt/term/dev/label

+ 1 - 1
rc/bin/man

@@ -86,7 +86,7 @@ fils=()
 if(~ $search yes)
 for(i in $S/$sec){
 	if(/bin/test -f $i/INDEX){
-		try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //'}
+		try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //' | sort -u}
 		if(! ~ $#try 0)
 			fils=($fils $i/$try)
 	}

+ 2 - 0
sys/games/lib/fortunes

@@ -4170,3 +4170,5 @@ bool x = "false";  // valid C++ [sets x to true]
 # The below line not be changed otherwise we refuse to work
 having read AF_UNIX(7) i'm still don't see the point.  portable programs should not do this.  portable programs should not do that.  the details of this varies from implementation to implementation.  none of the following socket things ... are implemented.  the name is limited to 107 bytes.   - forsyth
 Please wait. This can take some time.
+I love troff. It reminds me of runoff, which reminds me of my youth, when VMS was in flower and knowledge of EDT and runoff was all a lad needed to make a good living as a tech writer.  - Frank Willison
+General Internet error has occurred. - [OpenOffice.org 2.0]

+ 2 - 0
sys/lib/dist/mkfile

@@ -157,6 +157,7 @@ worldwritable-mail:V:
 9-export:V: 9.tar.gz
 	9fs sources
 	cp 9.tar.gz /n/sources/extra/9.tgz
+	chmod +t    /n/sources/extra/9.tgz
 
 plan9.tar.bz2:V:
 	@{
@@ -176,3 +177,4 @@ plan9.tar.bz2:V:
 plan9-export:V: plan9.tar.bz2
 	9fs sources
 	mv plan9.tar.bz2 /n/sources/extra/plan9.tar.bz2
+	chmod +t	 /n/sources/extra/plan9.tar.bz2

+ 48 - 0
sys/man/8/fshalt

@@ -0,0 +1,48 @@
+.TH FSHALT 8
+.SH NAME
+fshalt, reboot \- halt any local file systems and optionally reboot the system
+.SH SYNOPSIS
+.B fshalt
+[
+.B -r
+]
+.br
+.B reboot
+.SH DESCRIPTION
+.I Fshalt
+syncs all local
+.IR fossil (4),
+.IR venti (8),
+and
+.IR kfs (4)
+servers,
+then halts all local
+.IR fossil
+and
+.IR kfs
+servers.
+If given
+.BR -r ,
+.I fshalt
+will then reboot the machine.
+The halting and rebooting is done by copying all necessary
+commands into a
+.IR ramfs (4)
+file system and changing directory there before attempting to halt
+file systems,
+so this will work even on standalone machines with their roots on
+local file systems.
+.PP
+.I Reboot
+restarts the machine it is invoked on.
+.SH SOURCE
+.B /rc/bin/fshalt
+.br
+.B /rc/bin/reboot
+.SH SEE ALSO
+.IR cons (3),
+.IR reboot (8)
+.SH BUGS
+On standalone machines, it will be impossible to do anything
+after invoking bare
+.LR fshalt .

+ 1 - 1
sys/man/8/listen

@@ -27,7 +27,7 @@ listens on a network for inbound calls to local services.
 .I Net
 is the network protocol on which to listen, by default
 .BR /net/il .
-The services available are executable files in
+The services available are executable, non-empty files in
 .I srvdir
 or
 .IR trustsrvdir .

+ 1 - 1
sys/src/ape/lib/ap/plan9/kill.c

@@ -46,7 +46,7 @@ kill(pid_t pid, int sig)
 	if(pid < 0) {
 		sid = getpgrp();
 		mpid = getpid();
-		if(setpgid(mpid, -pid) > 0) {
+		if(setpgid(mpid, -pid) == 0) {
 			r = note(mpid, msg, "/proc/%d/notepg");
 			setpgid(mpid, sid);
 		} else {

+ 3 - 1
sys/src/ape/lib/ap/syscall/genall

@@ -2,7 +2,9 @@
 # genall - generate the APE versions of the system call C interfaces.
 #	must be invoked by mk so that the right env variables are set.
 rfork e
-SYSH=/sys/src/libc/9syscall/sys.h
+# ugh. sources's build process can't hack absolute path names.
+# we're in /sys/src/ape/lib/ap/syscall.
+SYSH=../../../../libc/9syscall/sys.h	# /sys/src/libc/9syscall/sys.h
 
 SYS=`{sed '/^#define._/d; s/#define.([A-Z0-9_]*).*/\1/' $SYSH}
 for(I in $SYS) {

+ 3 - 1
sys/src/ape/lib/ap/syscall/mkfile

@@ -4,7 +4,9 @@ NPROC=1
 install:V: genall gencall
 	genall
 
-gencall:D: /sys/src/libc/9syscall/mkfile
+# ugh. sources's build process can't hack absolute path names.
+# we're in /sys/src/ape/lib/ap/syscall.
+gencall:D: ../../../../libc/9syscall/mkfile	# /sys/src/libc/9syscall/mkfile
 	{
 		echo '#!/bin/rc'
 		sed -n -e 's/seek/_SEEK/g' -e '/switch/,/\$AS /p' $prereq

+ 13 - 7
sys/src/cmd/aux/listen.c

@@ -353,17 +353,23 @@ dolisten(char *proto, char *dir, int ctl, char *srvdir, char *dialstr)
 }
 
 /*
- * look in the service directory for the service
+ * look in the service directory for the service.
+ * if the shell script or program is zero-length, ignore it,
+ * thus providing a way to disable a service with a bind.
  */
 int 
 findserv(char *proto, char *dir, Service *s, char *srvdir)
 {
+	int rv;
+	Dir *d;
+
 	if(!getserv(proto, dir, s))
 		return 0;
-	sprint(s->prog, "%s/%s", srvdir, s->serv);
-	if(access(s->prog, AEXIST) >= 0)
-		return 1;
-	return 0;
+	snprint(s->prog, sizeof s->prog, "%s/%s", srvdir, s->serv);
+	d = dirstat(s->prog);
+	rv = d && d->length > 0;
+	free(d);
+	return rv;
 }
 
 /*
@@ -396,7 +402,7 @@ getserv(char *proto, char *dir, Service *s)
 	 */
 	if(strlen(serv) +strlen(proto) >= NAMELEN || utfrune(serv, L'/') || *serv == '.')
 		return 0;
-	sprint(s->serv, "%s%s", proto, serv);
+	snprint(s->serv, sizeof s->serv, "%s%s", proto, serv);
 
 	return 1;
 }
@@ -438,7 +444,7 @@ newcall(int fd, char *proto, char *dir, Service *s)
 			syslog(0, listenlog, "%s call for %s on chan %s", proto, s->serv, dir);
 	}
 
-	sprint(data, "%s/data", dir);
+	snprint(data, sizeof data, "%s/data", dir);
 	bind(data, "/dev/cons", MREPL);
 	dup(fd, 0);
 	dup(fd, 1);

+ 120 - 98
sys/src/cmd/fossil/check.c

@@ -2,18 +2,19 @@
 #include "dat.h"
 #include "fns.h"
 
-static void error(Fsck*, char*, ...);
-static void setBit(uchar*, u32int);
-static int getBit(uchar*, u32int);
-static int walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u32int epoch);
-static void warn(Fsck*, char*, ...);
-static void checkLeak(Fsck*);
-static void clrenop(Fsck*, Block*, int);
-static void closenop(Fsck*, Block*, u32int);
-static void clrinop(Fsck*, char*, MetaBlock*, int, Block*);
-static int printnop(char*, ...);
-static void checkEpochs(Fsck*);
-static void checkDirs(Fsck*);
+static void	checkDirs(Fsck*);
+static void	checkEpochs(Fsck*);
+static void	checkLeak(Fsck*);
+static void	closenop(Fsck*, Block*, u32int);
+static void	clrenop(Fsck*, Block*, int);
+static void	clrinop(Fsck*, char*, MetaBlock*, int, Block*);
+static void	error(Fsck*, char*, ...);
+static int	getBit(uchar*, u32int);
+static int	printnop(char*, ...);
+static void	setBit(uchar*, u32int);
+static int	walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize],
+			int type, u32int tag, u32int epoch);
+static void	warn(Fsck*, char*, ...);
 
 #pragma varargck argpos error 2
 #pragma varargck argpos warn 2
@@ -41,11 +42,11 @@ checkInit(Fsck *chk)
 }
 
 /*
- * BUG: Should merge checkEpochs and checkDirs so that 
+ * BUG: Should merge checkEpochs and checkDirs so that
  * bad blocks are only reported once, and so that errors in checkEpochs
  * can have the affected file names attached, and so that the file system
  * is only read once.
- * 
+ *
  * Also should summarize the errors instead of printing for every one
  * (e.g., XXX bad or unreachable blocks in /active/usr/rsc/foo).
  */
@@ -90,7 +91,7 @@ checkEpochs(Fsck *chk)
 	chk->xmap = vtMemAllocZ(nb/8+1);
 	chk->errmap = vtMemAllocZ(nb/8+1);
 
-	for(e=chk->fs->ehi; e >= chk->fs->elo; e--){
+	for(e = chk->fs->ehi; e >= chk->fs->elo; e--){
 		memset(chk->emap, 0, chk->nblocks/8+1);
 		memset(chk->xmap, 0, chk->nblocks/8+1);
 		checkEpoch(chk, e);
@@ -109,7 +110,7 @@ checkEpoch(Fsck *chk, u32int epoch)
 	Block *b;
 	Entry e;
 	Label l;
-	
+
 	chk->print("checking epoch %ud...\n", epoch);
 
 	for(a=0; a<chk->nblocks; a++){
@@ -161,10 +162,12 @@ checkEpoch(Fsck *chk, u32int epoch)
  * (ii) if b.e==bb.e,  then no other b' in e points at bb.
  * (iii) if !(b.state&Copied) and b.e==bb.e then no other b' points at bb.
  * (iv) if b is active then no other active b' points at bb.
- * (v) if b is a past life of b' then only one of b and b' is active (too hard to check)
+ * (v) if b is a past life of b' then only one of b and b' is active
+ *	(too hard to check)
  */
 static int
-walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u32int epoch)
+walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag,
+	u32int epoch)
 {
 	int i, ret;
 	u32int addr, ep;
@@ -172,7 +175,8 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 	Entry e;
 
 	if(b && chk->walkdepth == 0 && chk->printblocks)
-		chk->print("%V %d %#.8ux %#.8ux\n", b->score, b->l.type, b->l.tag, b->l.epoch);
+		chk->print("%V %d %#.8ux %#.8ux\n", b->score, b->l.type,
+			b->l.tag, b->l.epoch);
 
 	if(!chk->useventi && globalToLocal(score) == NilBlock)
 		return 1;
@@ -181,12 +185,14 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 
 	bb = cacheGlobal(chk->cache, score, type, tag, OReadOnly);
 	if(bb == nil){
-		error(chk, "could not load block %V type %d tag %ux: %R", score, type, tag);
+		error(chk, "could not load block %V type %d tag %ux: %R",
+			score, type, tag);
 		chk->walkdepth--;
 		return 0;
 	}
 	if(chk->printblocks)
-		chk->print("%*s%V %d %#.8ux %#.8ux\n", chk->walkdepth*2, "", score, type, tag, bb->l.epoch);
+		chk->print("%*s%V %d %#.8ux %#.8ux\n", chk->walkdepth*2, "",
+			score, type, tag, bb->l.epoch);
 
 	ret = 0;
 	addr = globalToLocal(score);
@@ -203,20 +209,22 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 				bb->addr, bb->l.epoch, bb->l.epochClose);
 			goto Exit;
 		}
-	
+
 		/* (ii) */
 		if(b->l.epoch == epoch && bb->l.epoch == epoch){
 			if(getBit(chk->emap, addr)){
-				error(chk, "walk: epoch join detected: addr %#ux %L", bb->addr, &bb->l);
+				error(chk, "walk: epoch join detected: addr %#ux %L",
+					bb->addr, &bb->l);
 				goto Exit;
 			}
 			setBit(chk->emap, addr);
 		}
-	
+
 		/* (iii) */
 		if(!(b->l.state&BsCopied) && b->l.epoch == bb->l.epoch){
 			if(getBit(chk->xmap, addr)){
-				error(chk, "walk: copy join detected; addr %#ux %L", bb->addr, &bb->l);
+				error(chk, "walk: copy join detected; addr %#ux %L",
+					bb->addr, &bb->l);
 				goto Exit;
 			}
 			setBit(chk->xmap, addr);
@@ -225,22 +233,26 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 
 	/* (iv) */
 	if(epoch == chk->fs->ehi){
-		/* since epoch==fs->ehi is first, amap is same as ``have seen active'' */
+		/*
+		 * since epoch==fs->ehi is first, amap is same as
+		 * ``have seen active''
+		 */
 		if(getBit(chk->amap, addr)){
-			error(chk, "walk: active join detected: addr %#ux %L", bb->addr, &bb->l);
+			error(chk, "walk: active join detected: addr %#ux %L",
+				bb->addr, &bb->l);
 			goto Exit;
 		}
 		if(bb->l.state&BsClosed)
-			error(chk, "walk: addr %#ux: block is in active tree but is closed", addr);
-	}else{
-		if(!getBit(chk->amap, addr)){
+			error(chk, "walk: addr %#ux: block is in active tree but is closed",
+				addr);
+	}else
+		if(!getBit(chk->amap, addr))
 			if(!(bb->l.state&BsClosed)){
-				// error(chk, "walk: addr %#ux: block is not in active tree, not closed (%d)", addr, bb->l.epochClose);
+				// error(chk, "walk: addr %#ux: block is not in active tree, not closed (%d)",
+				// addr, bb->l.epochClose);
 				chk->close(chk, bb, epoch+1);
 				chk->nclose++;
 			}
-		}
-	}
 
 	if(getBit(chk->amap, addr)){
 		ret = 1;
@@ -258,8 +270,9 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 	switch(type){
 	default:
 		/* pointer block */
-		for(i=0; i<chk->bsize/VtScoreSize; i++)
-			if(!walkEpoch(chk, bb, bb->data + i*VtScoreSize, type-1, tag, epoch)){
+		for(i = 0; i < chk->bsize/VtScoreSize; i++)
+			if(!walkEpoch(chk, bb, bb->data + i*VtScoreSize,
+			    type-1, tag, epoch)){
 				setBit(chk->errmap, bb->addr);
 				chk->clrp(chk, bb, i);
 				chk->nclrp++;
@@ -268,9 +281,10 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 	case BtData:
 		break;
 	case BtDir:
-		for(i=0; i<chk->bsize/VtEntrySize; i++){
+		for(i = 0; i < chk->bsize/VtEntrySize; i++){
 			if(!entryUnpack(&e, bb->data, i)){
-				// error(chk, "walk: could not unpack entry: %ux[%d]: %R", addr, i);
+				// error(chk, "walk: could not unpack entry: %ux[%d]: %R",
+				//	addr, i);
 				setBit(chk->errmap, bb->addr);
 				chk->clre(chk, bb, i);
 				chk->nclre++;
@@ -278,7 +292,8 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 			}
 			if(!(e.flags & VtEntryActive))
 				continue;
-//fprint(2, "%x[%d] tag=%x snap=%d score=%V\n", addr, i, e.tag, e.snap, e.score);
+if(0)			fprint(2, "%x[%d] tag=%x snap=%d score=%V\n",
+				addr, i, e.tag, e.snap, e.score);
 			ep = epoch;
 			if(e.snap != 0){
 				if(e.snap >= epoch){
@@ -294,22 +309,24 @@ walkEpoch(Fsck *chk, Block *b, uchar score[VtScoreSize], int type, u32int tag, u
 			if(e.flags & VtEntryLocal){
 				if(e.tag < UserTag)
 				if(e.tag != RootTag || tag != RootTag || i != 1){
-					// error(chk, "bad tag in entry: %ux[%d] tag = %ux", addr, i, e.tag);
+					// error(chk, "bad tag in entry: %ux[%d] tag = %ux",
+					//	addr, i, e.tag);
 					setBit(chk->errmap, bb->addr);
 					chk->clre(chk, bb, i);
 					chk->nclre++;
 					continue;
 				}
-			}else{
+			}else
 				if(e.tag != 0){
-					// error(chk, "bad tag in entry: %ux[%d] tag = %ux", addr, i, e.tag);
+					// error(chk, "bad tag in entry: %ux[%d] tag = %ux",
+					//	addr, i, e.tag);
 					setBit(chk->errmap, bb->addr);
 					chk->clre(chk, bb, i);
 					chk->nclre++;
 					continue;
 				}
-			}
-			if(!walkEpoch(chk, bb, e.score, entryType(&e), e.tag, ep)){
+			if(!walkEpoch(chk, bb, e.score, entryType(&e),
+			    e.tag, ep)){
 				setBit(chk->errmap, bb->addr);
 				chk->clre(chk, bb, i);
 				chk->nclre++;
@@ -333,16 +350,14 @@ Exit:
 static void
 checkLeak(Fsck *chk)
 {
-	u32int a;
-	Label l;
-	u32int nfree;
-	u32int nlost;
+	u32int a, nfree, nlost;
 	Block *b;
+	Label l;
 
 	nfree = 0;
 	nlost = 0;
 
-	for(a=0; a<chk->nblocks; a++){
+	for(a = 0; a < chk->nblocks; a++){
 		if(!readLabel(chk->cache, &l, a)){
 			error(chk, "could not read label: addr %ux %d %d: %R",
 				a, l.type, l.state);
@@ -350,7 +365,8 @@ checkLeak(Fsck *chk)
 		}
 		if(getBit(chk->amap, a))
 			continue;
-		if(l.state == BsFree || l.epochClose <= chk->fs->elo || l.epochClose == l.epoch){
+		if(l.state == BsFree || l.epochClose <= chk->fs->elo ||
+		    l.epochClose == l.epoch){
 			nfree++;
 			setBit(chk->amap, a);
 			continue;
@@ -371,9 +387,9 @@ checkLeak(Fsck *chk)
 		blockPut(b);
 	}
 	chk->print("fsys blocks: total=%ud used=%ud(%.1f%%) free=%ud(%.1f%%) lost=%ud(%.1f%%)\n",
-		chk->nblocks, 
-		chk->nblocks-nfree-nlost, 
-		100.*(chk->nblocks-nfree-nlost)/chk->nblocks,
+		chk->nblocks,
+		chk->nblocks-nfree-nlost,
+		100.*(chk->nblocks - nfree - nlost)/chk->nblocks,
 		nfree, 100.*nfree/chk->nblocks,
 		nlost, 100.*nlost/chk->nblocks);
 }
@@ -383,13 +399,15 @@ checkLeak(Fsck *chk)
  * Check that all sources in the tree are accessible.
  */
 static Source *
-openSource(Fsck *chk, Source *s, char *name, uchar *bm, u32int offset, u32int gen, int dir, MetaBlock *mb, int i, Block *b)
+openSource(Fsck *chk, Source *s, char *name, uchar *bm, u32int offset,
+	u32int gen, int dir, MetaBlock *mb, int i, Block *b)
 {
 	Source *r;
 
 	r = nil;
 	if(getBit(bm, offset)){
-		warn(chk, "multiple references to source: %s -> %d", name, offset);
+		warn(chk, "multiple references to source: %s -> %d",
+			name, offset);
 		goto Err;
 	}
 	setBit(bm, offset);
@@ -419,11 +437,10 @@ Err:
 }
 
 typedef struct MetaChunk MetaChunk;
-
 struct MetaChunk {
-	ushort offset;
-	ushort size;
-	ushort index;
+	ushort	offset;
+	ushort	size;
+	ushort	index;
 };
 
 static int
@@ -452,9 +469,9 @@ chkMetaBlock(MetaBlock *mb)
 
 	mc = vtMemAlloc(mb->nindex*sizeof(MetaChunk));
 	p = mb->buf + MetaHeaderSize;
-	for(i = 0; i<mb->nindex; i++){
-		mc[i].offset = (p[0]<<8) | p[1];
-		mc[i].size = (p[2]<<8) | p[3];
+	for(i = 0; i < mb->nindex; i++){
+		mc[i].offset = p[0]<<8 | p[1];
+		mc[i].size =   p[2]<<8 | p[3];
 		mc[i].index = i;
 		p += MetaIndexSize;
 	}
@@ -465,16 +482,14 @@ chkMetaBlock(MetaBlock *mb)
 	oo = MetaHeaderSize + mb->maxindex*MetaIndexSize;
 	o = oo;
 	n = 0;
-	for(i=0; i<mb->nindex; i++){
+	for(i = 0; i < mb->nindex; i++){
 		o = mc[i].offset;
 		n = mc[i].size;
 		if(o < oo)
 			goto Err;
 		oo += n;
 	}
-	if(o+n > mb->size)
-		goto Err;
-	if(mb->size - oo != mb->free)
+	if(o+n > mb->size || mb->size - oo != mb->free)
 		goto Err;
 
 	vtMemFree(mc);
@@ -485,10 +500,11 @@ if(0){
 	fprint(2, "metaChunks failed!\n");
 	oo = MetaHeaderSize + mb->maxindex*MetaIndexSize;
 	for(i=0; i<mb->nindex; i++){
-		fprint(2, "\t%d: %d %d\n", i, mc[i].offset, mc[i].offset + mc[i].size);
+		fprint(2, "\t%d: %d %d\n", i, mc[i].offset,
+			mc[i].offset + mc[i].size);
 		oo += mc[i].size;
 	}
-	fprint(2, "\tused=%d size=%d free=%d free2=%d\n", 
+	fprint(2, "\tused=%d size=%d free=%d free2=%d\n",
 		oo, mb->size, mb->free, mb->size - oo);
 }
 	vtMemFree(mc);
@@ -498,10 +514,9 @@ if(0){
 static void
 scanSource(Fsck *chk, char *name, Source *r)
 {
-	u32int nb, o;
+	u32int a, nb, o;
 	Block *b;
 	Entry e;
-	u32int a;
 
 	if(!chk->useventi && globalToLocal(r->score)==NilBlock)
 		return;
@@ -517,7 +532,7 @@ scanSource(Fsck *chk, char *name, Source *r)
 	setBit(chk->smap, a);
 
 	nb = (sourceGetSize(r) + r->dsize-1) / r->dsize;
-	for(o=0; o<nb; o++){
+	for(o = 0; o < nb; o++){
 		b = sourceBlock(r, o, OReadOnly);
 		if(b == nil){
 			error(chk, "could not read block in data file %s", name);
@@ -538,19 +553,19 @@ scanSource(Fsck *chk, char *name, Source *r)
 static void
 chkDir(Fsck *chk, char *name, Source *source, Source *meta)
 {
+	int i;
+	u32int a1, a2, nb, o;
+	char *s, *nn;
 	uchar *bm;
 	Block *b, *bb;
-	u32int nb, o;
-	MetaBlock mb;
 	DirEntry de;
 	Entry e1, e2;
+	MetaBlock mb;
 	MetaEntry me;
-	int i;
-	char *s, *nn;
 	Source *r, *mr;
-	u32int a1, a2;
 
-	if(!chk->useventi && globalToLocal(source->score)==NilBlock && globalToLocal(meta->score)==NilBlock)
+	if(!chk->useventi && globalToLocal(source->score)==NilBlock &&
+	    globalToLocal(meta->score)==NilBlock)
 		return;
 
 	if(!sourceLock2(source, meta, OReadOnly)){
@@ -575,19 +590,22 @@ chkDir(Fsck *chk, char *name, Source *source, Source *meta)
 	bm = vtMemAllocZ(sourceGetDirSize(source)/8 + 1);
 
 	nb = (sourceGetSize(meta) + meta->dsize - 1)/meta->dsize;
-	for(o=0; o<nb; o++){
+	for(o = 0; o < nb; o++){
 		b = sourceBlock(meta, o, OReadOnly);
 		if(b == nil){
-			error(chk, "could not read block in meta file: %s[%ud]: %R", name, o);
+			error(chk, "could not read block in meta file: %s[%ud]: %R",
+				name, o);
 			continue;
 		}
-if(0)fprint(2, "source %V:%d block %d addr %d\n", source->score, source->offset, o, b->addr);
+if(0)		fprint(2, "source %V:%d block %d addr %d\n", source->score,
+			source->offset, o, b->addr);
 		if(b->addr != NilBlock && getBit(chk->errmap, b->addr))
 			warn(chk, "previously reported error in block %ux is in %s",
 				b->addr, name);
 
 		if(!mbUnpack(&mb, b->data, meta->dsize)){
-			error(chk, "could not unpack meta block: %s[%ud]: %R", name, o);
+			error(chk, "could not unpack meta block: %s[%ud]: %R",
+				name, o);
 			blockPut(b);
 			continue;
 		}
@@ -600,12 +618,15 @@ if(0)fprint(2, "source %V:%d block %d addr %d\n", source->score, source->offset,
 		for(i=mb.nindex-1; i>=0; i--){
 			meUnpack(&me, &mb, i);
 			if(!deUnpack(&de, &me)){
-				error(chk, "cound not unpack dir entry: %s[%ud][%d]: %R", name, o, i);
+				error(chk,
+				  "could not unpack dir entry: %s[%ud][%d]: %R",
+					name, o, i);
 				continue;
 			}
 			if(s && strcmp(s, de.elem) <= 0)
-				error(chk, "dir entry out of order: %s[%ud][%d] = %s last = %s", name, o, i,
-					de.elem, s);
+				error(chk,
+			   "dir entry out of order: %s[%ud][%d] = %s last = %s",
+					name, o, i, de.elem, s);
 			vtMemFree(s);
 			s = vtStrDup(de.elem);
 			nn = smprint("%s/%s", name, de.elem);
@@ -613,16 +634,15 @@ if(0)fprint(2, "source %V:%d block %d addr %d\n", source->score, source->offset,
 				error(chk, "out of memory");
 				continue;
 			}
-			if(chk->printdirs){
+			if(chk->printdirs)
 				if(de.mode&ModeDir)
 					chk->print("%s/\n", nn);
-			}
-			if(chk->printfiles){
+			if(chk->printfiles)
 				if(!(de.mode&ModeDir))
 					chk->print("%s\n", nn);
-			}
 			if(!(de.mode & ModeDir)){
-				r = openSource(chk, source, nn, bm, de.entry, de.gen, 0, &mb, i, b);
+				r = openSource(chk, source, nn, bm, de.entry,
+					de.gen, 0, &mb, i, b);
 				if(r != nil){
 					if(sourceLock(r, OReadOnly)){
 						scanSource(chk, nn, r);
@@ -635,14 +655,16 @@ if(0)fprint(2, "source %V:%d block %d addr %d\n", source->score, source->offset,
 				continue;
 			}
 
-			r = openSource(chk, source, nn, bm, de.entry, de.gen, 1, &mb, i, b);
+			r = openSource(chk, source, nn, bm, de.entry,
+				de.gen, 1, &mb, i, b);
 			if(r == nil){
 				deCleanup(&de);
 				free(nn);
 				continue;
 			}
 
-			mr = openSource(chk, source, nn, bm, de.mentry, de.mgen, 0, &mb, i, b);
+			mr = openSource(chk, source, nn, bm, de.mentry,
+				de.mgen, 0, &mb, i, b);
 			if(mr == nil){
 				sourceClose(r);
 				deCleanup(&de);
@@ -672,7 +694,8 @@ if(0)fprint(2, "source %V:%d block %d addr %d\n", source->score, source->offset,
 		if(r == nil)
 			continue;
 		warn(chk, "non referenced entry in source %s[%d]", name, o);
-		if((bb = sourceBlock(source, o/(source->dsize/VtEntrySize), OReadOnly)) != nil){
+		if((bb = sourceBlock(source, o/(source->dsize/VtEntrySize),
+		    OReadOnly)) != nil){
 			if(bb->addr != NilBlock){
 				setBit(chk->errmap, bb->addr);
 				chk->clre(chk, bb, o%(source->dsize/VtEntrySize));
@@ -724,12 +747,12 @@ getBit(uchar *bmap, u32int addr)
 static void
 error(Fsck *chk, char *fmt, ...)
 {
-	static nerr;
+	char buf[256];
 	va_list arg;
-	char buf[128];
+	static int nerr;
 
 	va_start(arg, fmt);
-	vseprint(buf, buf+sizeof(buf), fmt, arg);
+	vseprint(buf, buf+sizeof buf, fmt, arg);
 	va_end(arg);
 
 	chk->print("error: %s\n", buf);
@@ -741,13 +764,12 @@ error(Fsck *chk, char *fmt, ...)
 static void
 warn(Fsck *chk, char *fmt, ...)
 {
-	static nerr;
+	char buf[256];
 	va_list arg;
-	char buf[128];
-
+	static int nerr;
 
 	va_start(arg, fmt);
-	vseprint(buf, buf+sizeof(buf), fmt, arg);
+	vseprint(buf, buf+sizeof buf, fmt, arg);
 	va_end(arg);
 
 	chk->print("error: %s\n", buf);

+ 2 - 1
sys/src/cmd/fossil/flproto

@@ -2,7 +2,7 @@
 # Test filesystem.
 #
 fsys main config /tmp/fossil
-fsys main open -AWP
+fsys main open
 fsys main 
 uname rsc :rsc
 uname sys +rsc
@@ -11,3 +11,4 @@ uname sys +jmk
 srv -p test.fscons
 srv test.fossil
 create /active/tmp sys sys d777
+srv -N test.none

+ 9 - 0
sys/src/cmd/mkfile

@@ -15,12 +15,21 @@ NOMK=$NOTSYS|$BUGGERED|$OUTOFDATE
 
 cpuobjtype=`{sed -n 's/^O=//p' /$cputype/mkfile}
 DIRS=`{ls -l | sed '/^d/!d; s/.* //; /^('$NOMK')$/d'}
+APEDIRS=awk bzip2 compress cvs eqn grap gs links-ape lp pic postscript spin \
+	tex troff
 
 none:VQ:
 	echo usage: mk cmds, dirs, all, install, installall, '$O'.cmd, cmd.install, or cmd.installall
 
 cmds:V:	$PROGS
 
+ape:V: $APE
+	for(i in $APEDIRS) @{
+		cd $i
+		echo mk $i
+		mk $MKFLAGS all
+	}
+
 dirs:V:
 	for(i in cc $DIRS) @{
 		cd $i

+ 12 - 10
sys/src/cmd/ndb/convDNS2M.c

@@ -17,10 +17,10 @@ struct Dict
 		ushort	offset;		/* pointer to packed name in message */
 		char	*name;		/* pointer to unpacked name in buf */
 	} x[Ndict];
-	int	n;		/* size of dictionary */
-	uchar	*start;		/* start of packed message */
-	char	buf[4*1024];	/* buffer for unpacked names */
-	char	*ep;		/* first free char in buf */
+	int n;			/* size of dictionary */
+	uchar *start;		/* start of packed message */
+	char buf[4*1024];	/* buffer for unpacked names */
+	char *ep;		/* first free char in buf */
 };
 
 #define NAME(x)		p = pname(p, ep, x, dp)
@@ -129,17 +129,17 @@ pv6addr(uchar *p, uchar *ep, char *name)
 static uchar*
 pname(uchar *p, uchar *ep, char *np, Dict *dp)
 {
-	int i;
 	char *cp;
+	int i;
 	char *last;		/* last component packed */
 
-	if(strlen(np) >= Domlen) /* make sure we don't exceed DNS limits */
+	if(strlen(np) >= Domlen)	/* make sure we don't exceed DNS limits */
 		return ep+1;
 
 	last = 0;
 	while(*np){
 		/* look through every component in the dictionary for a match */
-		for(i = 0; i < dp->n; i++)
+		for(i = 0; i < dp->n; i++){
 			if(strcmp(np, dp->x[i].name) == 0){
 				if(ep - p < 2)
 					return ep+1;
@@ -147,9 +147,10 @@ pname(uchar *p, uchar *ep, char *np, Dict *dp)
 				*p++ = dp->x[i].offset;
 				return p;
 			}
+		}
 
 		/* if there's room, enter this name in dictionary */
-		if(dp->n < Ndict)
+		if(dp->n < Ndict){
 			if(last){
 				/* the whole name is already in dp->buf */
 				last = strchr(last, '.') + 1;
@@ -159,7 +160,7 @@ pname(uchar *p, uchar *ep, char *np, Dict *dp)
 			} else {
 				/* add to dp->buf */
 				i = strlen(np);
-				if(dp->ep + i + 1 < &dp->buf[sizeof dp->buf]){
+				if(dp->ep + i + 1 < &dp->buf[sizeof(dp->buf)]){
 					strcpy(dp->ep, np);
 					dp->x[dp->n].name = dp->ep;
 					last = dp->ep;
@@ -168,10 +169,11 @@ pname(uchar *p, uchar *ep, char *np, Dict *dp)
 					dp->n++;
 				}
 			}
+		}
 
 		/* put next component into message */
 		cp = strchr(np, '.');
-		if(cp == nil){
+		if(cp == 0){
 			i = strlen(np);
 			cp = np + i;	/* point to null terminator */
 		} else {

+ 100 - 184
sys/src/cmd/ndb/convM2DNS.c

@@ -9,91 +9,66 @@ struct Scan
 	uchar	*base;
 	uchar	*p;
 	uchar	*ep;
-
 	char	*err;
-	char	errbuf[256];	/* hold a formatted error sometimes */
-	int	rcode;		/* outgoing response codes (reply flags) */
 };
 
-#define NAME(x)		gname(x, rp, sp)
-#define SYMBOL(x)	(x = gsym(rp, sp))
-#define STRING(x)	(x = gstr(rp, sp))
-#define USHORT(x)	(x = gshort(rp, sp))
-#define ULONG(x)	(x = glong(rp, sp))
-#define UCHAR(x)	(x = gchar(rp, sp))
-#define V4ADDR(x)	(x = gv4addr(rp, sp))
-#define V6ADDR(x)	(x = gv6addr(rp, sp))
-#define BYTES(x, y)	(y = gbytes(rp, sp, &x, len - (sp->p - data)))
-
-static int
-errneg(RR *rp, Scan *sp, int actual)
-{
-	snprint(sp->errbuf, sizeof sp->errbuf, "negative len %d: %R",
-		actual, rp);
-	sp->err = sp->errbuf;
-	return 0;
-}
+#define NAME(x)		gname(x, sp)
+#define SYMBOL(x)	(x = gsym(sp))
+#define STRING(x)	(x = gstr(sp))
+#define USHORT(x)	(x = gshort(sp))
+#define ULONG(x)	(x = glong(sp))
+#define UCHAR(x)	(x = gchar(sp))
+#define V4ADDR(x)	(x = gv4addr(sp))
+#define V6ADDR(x)	(x = gv6addr(sp))
+#define BYTES(x, y)	(y = gbytes(sp, &x, len - (sp->p - data)))
 
-static int
-errtoolong(RR *rp, Scan *sp, int actual, int nominal, char *where)
-{
-	char *p, *ep;
-	char ptype[64];
-
-	p =  sp->errbuf;
-	ep = sp->errbuf + sizeof sp->errbuf - 1;
-	if (where)
-		p = seprint(p, ep, "%s: ", where);
-	if (rp)
-		p = seprint(p, ep, "type %s RR: ",
-			rrname(rp->type, ptype, sizeof ptype));
-	p = seprint(p, ep, "wrong length (actual %d, nominal %d)",
-		actual, nominal);
-	if (rp)
-		seprint(p, ep, ": %R", rp);
-	sp->err = sp->errbuf;
-	return 0;
-}
+static char *toolong = "too long";
 
 /*
  *  get a ushort/ulong
  */
 static ushort
-gchar(RR *rp, Scan *sp)
+gchar(Scan *sp)
 {
 	ushort x;
 
 	if(sp->err)
 		return 0;
-	if(sp->ep - sp->p < 1)
-		return errtoolong(rp, sp, sp->ep - sp->p, 1, "gchar");
+	if(sp->ep - sp->p < 1){
+		sp->err = toolong;
+		return 0;
+	}
 	x = sp->p[0];
 	sp->p += 1;
 	return x;
 }
 static ushort
-gshort(RR *rp, Scan *sp)
+gshort(Scan *sp)
 {
 	ushort x;
 
 	if(sp->err)
 		return 0;
-	if(sp->ep - sp->p < 2)
-		return errtoolong(rp, sp, sp->ep - sp->p, 2, "gshort");
-	x = sp->p[0]<<8 | sp->p[1];
+	if(sp->ep - sp->p < 2){
+		sp->err = toolong;
+		return 0;
+	}
+	x = (sp->p[0]<<8) | sp->p[1];
 	sp->p += 2;
 	return x;
 }
 static ulong
-glong(RR *rp, Scan *sp)
+glong(Scan *sp)
 {
 	ulong x;
 
 	if(sp->err)
 		return 0;
-	if(sp->ep - sp->p < 4)
-		return errtoolong(rp, sp, sp->ep - sp->p, 4, "glong");
-	x = sp->p[0]<<24 | sp->p[1]<<16 | sp->p[2]<<8 | sp->p[3];
+	if(sp->ep - sp->p < 4){
+		sp->err = toolong;
+		return 0;
+	}
+	x = (sp->p[0]<<24) | (sp->p[1]<<16) | (sp->p[2]<<8) | sp->p[3];
 	sp->p += 4;
 	return x;
 }
@@ -102,29 +77,32 @@ glong(RR *rp, Scan *sp)
  *  get an ip address
  */
 static DN*
-gv4addr(RR *rp, Scan *sp)
+gv4addr(Scan *sp)
 {
 	char addr[32];
 
 	if(sp->err)
 		return 0;
-	if(sp->ep - sp->p < 4)
-		return (DN*)errtoolong(rp, sp, sp->ep - sp->p, 4, "gv4addr");
+	if(sp->ep - sp->p < 4){
+		sp->err = toolong;
+		return 0;
+	}
 	snprint(addr, sizeof(addr), "%V", sp->p);
 	sp->p += 4;
 
 	return dnlookup(addr, Cin, 1);
 }
 static DN*
-gv6addr(RR *rp, Scan *sp)
+gv6addr(Scan *sp)
 {
 	char addr[64];
 
 	if(sp->err)
 		return 0;
-	if(sp->ep - sp->p < IPaddrlen)
-		return (DN*)errtoolong(rp, sp, sp->ep - sp->p, IPaddrlen,
-			"gv6addr");
+	if(sp->ep - sp->p < IPaddrlen){
+		sp->err = toolong;
+		return 0;
+	}
 	snprint(addr, sizeof(addr), "%I", sp->p);
 	sp->p += IPaddrlen;
 
@@ -135,27 +113,25 @@ gv6addr(RR *rp, Scan *sp)
  *  get a string.  make it an internal symbol.
  */
 static DN*
-gsym(RR *rp, Scan *sp)
+gsym(Scan *sp)
 {
 	int n;
 	char sym[Strlen+1];
 
 	if(sp->err)
 		return 0;
-	n = 0;
-	if (sp->p < sp->ep)
-		n = *(sp->p++);
-	if(sp->ep - sp->p < n)
-		return (DN*)errtoolong(rp, sp, sp->ep - sp->p, n, "gsym");
+	n = *(sp->p++);
+	if(sp->p+n > sp->ep){
+		sp->err = toolong;
+		return 0;
+	}
 
 	if(n > Strlen){
-		sp->err = "illegal string (symbol)";
+		sp->err = "illegal string";
 		return 0;
 	}
 	strncpy(sym, (char*)sp->p, n);
 	sym[n] = 0;
-	if (strlen(sym) != n)
-		sp->err = "symbol shorter than declared length";
 	sp->p += n;
 
 	return dnlookup(sym, Csym, 1);
@@ -165,7 +141,7 @@ gsym(RR *rp, Scan *sp)
  *  get a string.  don't make it an internal symbol.
  */
 static Txt*
-gstr(RR *rp, Scan *sp)
+gstr(Scan *sp)
 {
 	int n;
 	char sym[Strlen+1];
@@ -173,11 +149,11 @@ gstr(RR *rp, Scan *sp)
 
 	if(sp->err)
 		return 0;
-	n = 0;
-	if (sp->p < sp->ep)
-		n = *(sp->p++);
-	if(sp->ep - sp->p < n)
-		return (Txt*)errtoolong(rp, sp, sp->ep - sp->p, n, "gstr");
+	n = *(sp->p++);
+	if(sp->p+n > sp->ep){
+		sp->err = toolong;
+		return 0;
+	}
 
 	if(n > Strlen){
 		sp->err = "illegal string";
@@ -185,8 +161,6 @@ gstr(RR *rp, Scan *sp)
 	}
 	strncpy(sym, (char*)sp->p, n);
 	sym[n] = 0;
-	if (strlen(sym) != n)
-		sp->err = "string shorter than declared length";
 	sp->p += n;
 
 	t = emalloc(sizeof(*t));
@@ -199,15 +173,14 @@ gstr(RR *rp, Scan *sp)
  *  get a sequence of bytes
  */
 static int
-gbytes(RR *rp, Scan *sp, uchar **p, int n)
+gbytes(Scan *sp, uchar **p, int n)
 {
-	*p = nil;			/* i think this is a good idea */
 	if(sp->err)
 		return 0;
-	if(n < 0)
-		return errneg(rp, sp, n);
-	if(sp->ep - sp->p < n)
-		return errtoolong(rp, sp, sp->ep - sp->p, n, "gbytes");
+	if(sp->p+n > sp->ep || n < 0){
+		sp->err = toolong;
+		return 0;
+	}
 	*p = emalloc(n);
 	memmove(*p, sp->p, n);
 	sp->p += n;
@@ -219,10 +192,13 @@ gbytes(RR *rp, Scan *sp, uchar **p, int n)
  *  get a domain name.  'to' must point to a buffer at least Domlen+1 long.
  */
 static char*
-gname(char *to, RR *rp, Scan *sp)
+gname(char *to, Scan *sp)
 {
-	int len, off, pointer, n;
-	char *tostart, *toend;
+	int len, off;
+	int pointer;
+	int n;
+	char *tostart;
+	char *toend;
 	uchar *p;
 
 	tostart = to;
@@ -231,14 +207,14 @@ gname(char *to, RR *rp, Scan *sp)
 	pointer = 0;
 	p = sp->p;
 	toend = to + Domlen;
-	for(len = 0; *p && p < sp->ep; len += pointer ? 0 : (n+1)){
+	for(len = 0; *p; len += pointer ? 0 : (n+1)){
 		if((*p & 0xc0) == 0xc0){
 			/* pointer to other spot in message */
 			if(pointer++ > 10){
 				sp->err = "pointer loop";
 				goto err;
 			}
-			off = (p[0]<<8 | p[1]) & 0x3ff;
+			off = ((p[0]<<8) + p[1]) & 0x3ff;
 			p = sp->base + off;
 			if(p >= sp->ep){
 				sp->err = "bad pointer";
@@ -247,12 +223,10 @@ gname(char *to, RR *rp, Scan *sp)
 			n = 0;
 			continue;
 		}
-		n = 0;
-		if (p < sp->ep)
-			n = *p++;
+		n = *p++;
 		if(len + n < Domlen - 1){
-			if(n > toend - to){
-				errtoolong(rp, sp, toend - to, n, "gname 1");
+			if(to + n > toend){
+				sp->err = toolong;
 				goto err;
 			}
 			memmove(to, p, n);
@@ -261,8 +235,7 @@ gname(char *to, RR *rp, Scan *sp)
 		p += n;
 		if(*p){
 			if(to >= toend){
-				errtoolong(rp, sp, to-tostart, toend-tostart,
-					"gname 2");
+				sp->err = toolong;
 				goto err;
 			}
 			*to++ = '.';
@@ -279,31 +252,17 @@ err:
 	return tostart;
 }
 
-/*
- * ms windows 2000 seems to get the bytes backward in the type field
- * of ptr records, so return a format error as feedback.
- */
-static void
-mstypehack(Scan *sp, int type, char *where)
-{
-	if ((uchar)type == 0 && (uchar)(type>>8) != 0) {
-		syslog(0, "dns",
-			"%s: byte-swapped type field in ptr rr from win2k",
-			where);
-		if (sp->rcode == 0)
-			sp->rcode = Rformat;
-	}
-}
-
 /*
  *  convert the next RR from a message
  */
 static RR*
-convM2RR(Scan *sp, char *what)
+convM2RR(Scan *sp)
 {
-	RR *rp = nil;
-	int type, class, len;
+	RR *rp;
+	int type;
+	int class;
 	uchar *data;
+	int len;
 	char dname[Domlen+1];
 	Txt *t, **l;
 
@@ -312,7 +271,6 @@ retry:
 	USHORT(type);
 	USHORT(class);
 
-	mstypehack(sp, type, "convM2RR");
 	rp = rralloc(type);
 	rp->owner = dnlookup(dname, class, 1);
 	rp->type = type;
@@ -322,20 +280,9 @@ retry:
 	USHORT(len);
 	data = sp->p;
 
-	/*
-	 * ms windows generates a lot of badly-formatted hints.
-	 * hints are only advisory, so don't log complaints about them.
-	 * it also generates answers in which p overshoots ep by exactly
-	 * one byte; this seems to be harmless, so don't log them either.
-	 */
-	if (sp->ep - sp->p < len &&
-	   !(strcmp(what, "hints") == 0 ||
-	     sp->p == sp->ep + 1 && strcmp(what, "answers") == 0)) {
-		syslog(0, "dns", "%s sp: base %#p p %#p ep %#p len %d", what,
-			sp->base, sp->p, sp->ep, len);	/* DEBUG */
-		errtoolong(rp, sp, sp->ep - sp->p, len, "convM2RR");
-	}
-	if(sp->err || sp->rcode){
+	if(sp->p + len > sp->ep)
+		sp->err = toolong;
+	if(sp->err){
 		rrfree(rp);
 		return 0;
 	}
@@ -345,7 +292,6 @@ retry:
 		/* unknown type, just ignore it */
 		sp->p = data + len;
 		rrfree(rp);
-		rp = nil;
 		goto retry;
 	case Thinfo:
 		SYMBOL(rp->cpu);
@@ -360,11 +306,11 @@ retry:
 		break;
 	case Tmg:
 	case Tmr:
-		rp->mb  = dnlookup(NAME(dname), Cin, 1);
+		rp->mb = dnlookup(NAME(dname), Cin, 1);
 		break;
 	case Tminfo:
 		rp->rmb = dnlookup(NAME(dname), Cin, 1);
-		rp->mb  = dnlookup(NAME(dname), Cin, 1);
+		rp->mb = dnlookup(NAME(dname), Cin, 1);
 		break;
 	case Tmx:
 		USHORT(rp->pref);
@@ -381,7 +327,7 @@ retry:
 		break;
 	case Tsoa:
 		rp->host = dnlookup(NAME(dname), Cin, 1);
-		rp->rmb  = dnlookup(NAME(dname), Cin, 1);
+		rp->rmb = dnlookup(NAME(dname), Cin, 1);
 		ULONG(rp->soa->serial);
 		ULONG(rp->soa->refresh);
 		ULONG(rp->soa->retry);
@@ -391,7 +337,7 @@ retry:
 	case Ttxt:
 		l = &rp->txt;
 		*l = nil;
-		while(sp->p - data < len){
+		while(sp->p-data < len){
 			STRING(t);
 			*l = t;
 			l = &t->next;
@@ -402,7 +348,7 @@ retry:
 		break;
 	case Trp:
 		rp->rmb = dnlookup(NAME(dname), Cin, 1);
-		rp->rp  = dnlookup(NAME(dname), Cin, 1);
+		rp->rp = dnlookup(NAME(dname), Cin, 1);
 		break;
 	case Tkey:
 		USHORT(rp->key->flags);
@@ -428,26 +374,8 @@ retry:
 		BYTES(rp->cert->data, rp->cert->dlen);
 		break;
 	}
-	if(sp->p - data != len) {
-		char ptype[64];
-
-		/*
-		 * ms windows 2000 generates cname queries for reverse lookups
-		 * with this particular error.  don't bother logging it.
-		 *
-		 * server: input error: bad cname RR len (actual 2 != len 0):
-		 * 235.9.104.135.in-addr.arpa cname
-		 *	235.9.104.135.in-addr.arpa from 135.104.9.235
-		 */
-		if (type == Tcname && sp->p - data == 2 && len == 0)
-			return rp;
-
-		snprint(sp->errbuf, sizeof sp->errbuf,
-			"bad %s RR len (actual %lud != len %d): %R",
-			rrname(type, ptype, sizeof ptype),
-			sp->p - data, len, rp);
-		sp->err = sp->errbuf;
-	}
+	if(sp->p - data != len)
+		sp->err = "bad RR len";
 	return rp;
 }
 
@@ -458,16 +386,16 @@ static RR*
 convM2Q(Scan *sp)
 {
 	char dname[Domlen+1];
-	int type, class;
-	RR *rp = nil;
+	int type;
+	int class;
+	RR *rp;
 
 	NAME(dname);
 	USHORT(type);
 	USHORT(class);
-	if(sp->err || sp->rcode)
+	if(sp->err)
 		return 0;
 
-	mstypehack(sp, type, "convM2Q");
 	rp = rralloc(type);
 	rp->owner = dnlookup(dname, class, 1);
 
@@ -475,20 +403,21 @@ convM2Q(Scan *sp)
 }
 
 static RR*
-rrloop(Scan *sp, char *what, int count, int quest)
+rrloop(Scan *sp, int count, int quest)
 {
 	int i;
+	static char errbuf[64];
 	RR *first, *rp, **l;
 
-	if(sp->err || sp->rcode)
+	if(sp->err)
 		return 0;
 	l = &first;
 	first = 0;
 	for(i = 0; i < count; i++){
-		rp = quest ? convM2Q(sp) : convM2RR(sp, what);
-		if(rp == nil)
+		rp = quest ? convM2Q(sp) : convM2RR(sp);
+		if(rp == 0)
 			break;
-		if(sp->err || sp->rcode){
+		if(sp->err){
 			rrfree(rp);
 			break;
 		}
@@ -499,44 +428,31 @@ rrloop(Scan *sp, char *what, int count, int quest)
 }
 
 /*
- *  convert the next DNS from a message stream.
- *  if there are formatting errors or the like during parsing of the message,
- *  set *codep to the outgoing response code (e.g., Rformat), which will
- *  abort processing and reply immediately with the outgoing response code.
+ *  convert the next DNS from a message stream
  */
 char*
-convM2DNS(uchar *buf, int len, DNSmsg *m, int *codep)
+convM2DNS(uchar *buf, int len, DNSmsg *m)
 {
 	Scan scan;
 	Scan *sp;
 	char *err;
-	RR *rp = nil;
 
-	if (codep)
-		*codep = 0;
-	assert(len >= 0);
 	scan.base = buf;
 	scan.p = buf;
 	scan.ep = buf + len;
-	scan.err = nil;
-	scan.errbuf[0] = '\0';
-	scan.rcode = 0;
+	scan.err = 0;
 	sp = &scan;
-
-	memset(m, 0, sizeof *m);
+	memset(m, 0, sizeof(DNSmsg));
 	USHORT(m->id);
 	USHORT(m->flags);
 	USHORT(m->qdcount);
 	USHORT(m->ancount);
 	USHORT(m->nscount);
 	USHORT(m->arcount);
-
-	m->qd = rrloop(sp, "questions",	m->qdcount, 1);
-	m->an = rrloop(sp, "answers",	m->ancount, 0);
-	m->ns = rrloop(sp, "nameservers",m->nscount, 0);
+	m->qd = rrloop(sp, m->qdcount, 1);
+	m->an = rrloop(sp, m->ancount, 0);
+	m->ns = rrloop(sp, m->nscount, 0);
 	err = scan.err;				/* live with bad ar's */
-	m->ar = rrloop(sp, "hints",	m->arcount, 0);
-	if (codep)
-		*codep = scan.rcode;
+	m->ar = rrloop(sp, m->arcount, 0);
 	return err;
 }

+ 1 - 1
sys/src/cmd/ndb/csquery.c

@@ -22,7 +22,7 @@ query(char *addr)
 	fd = open(server, ORDWR);
 	if(fd < 0)
 		sysfatal("cannot open %s: %r", server);
-	if(write(fd, addr, strlen(addr)) != strlen(addr)){
+	if(write(fd, addr, strlen(addr)) <= 0){
 		if(!statusonly)
 			fprint(2, "translating %s: %r\n", addr);
 		status = "errors";

+ 50 - 48
sys/src/cmd/ndb/dblookup.c

@@ -68,17 +68,16 @@ opendatabase(void)
  *  shared state there.
  *
  *  e.g. for x.research.bell-labs.com, first look for a match against
- *       the x.research.bell-labs.com.  If nothing matches,
- *	 try *.research.bell-labs.com.
+ *       the x.research.bell-labs.com.  If nothing matches, try *.research.bell-labs.com.
  */
 RR*
 dblookup(char *name, int class, int type, int auth, int ttl)
 {
-	int err;
-	char *wild, *cp;
-	char buf[256];
 	RR *rp, *tp;
+	char buf[256];
+	char *wild, *cp;
 	DN *dp, *ndp;
+	int err;
 	static int parallel;
 	static int parfd[2];
 	static char token[1];
@@ -138,14 +137,14 @@ dblookup(char *name, int class, int type, int auth, int ttl)
 	}
 out:
 	/* add owner to uncached records */
-	if(rp)
+	if(rp){
 		for(tp = rp; tp; tp = tp->next)
 			tp->owner = dp;
-	else {
-		/* don't call it non-existent (etc.) if it's not ours */
+	} else {
+		/* don't call it non-existent if it's not ours */
 		if(err == Rname && !inmyarea(name))
 			err = Rserver;
-		dp->respcode = err;
+		dp->nonexistent = err;
 	}
 
 	unlock(&dblock);
@@ -463,13 +462,13 @@ soarr(Ndbtuple *entry, Ndbtuple *pair)
 		rp->rmb = dnlookup(mailbox, Cin, 1);
 	}
 
-	/*  hang dns slaves off of the soa.  this is
+	/*  hang dns slaves off of the soa.  this is 
 	 *  for managing the area.
 	 */
 	for(t = entry; t != nil; t = t->entry)
 		if(strcmp(t->attr, "dnsslave") == 0)
 			addserver(&rp->soa->slaves, t->val);
-
+			
 	return rp;
 }
 
@@ -528,8 +527,9 @@ dbfile2area(Ndb *db)
 	if(debug)
 		syslog(0, logfile, "rereading %s", db->file);
 	Bseek(&db->b, 0, 0);
-	while(t = ndbparse(db))
+	while(t = ndbparse(db)){
 		ndbfree(t);
+	}
 }
 
 /*
@@ -546,20 +546,22 @@ dbpair2cache(DN *dp, Ndbtuple *entry, Ndbtuple *pair)
 	if(cistrcmp(pair->attr, "ip") == 0){
 		dp->ordinal = ord++;
 		rp = addrrr(entry, pair);
-	} else 	if(cistrcmp(pair->attr, "ns") == 0)
+	} else 	if(cistrcmp(pair->attr, "ns") == 0){
 		rp = nsrr(entry, pair);
-	else if(cistrcmp(pair->attr, "soa") == 0) {
+	} else if(cistrcmp(pair->attr, "soa") == 0){
 		rp = soarr(entry, pair);
 		addarea(dp, rp, pair);
-	} else if(cistrcmp(pair->attr, "mx") == 0)
+	} else if(cistrcmp(pair->attr, "mx") == 0){
 		rp = mxrr(entry, pair);
-	else if(cistrcmp(pair->attr, "cname") == 0)
+	} else if(cistrcmp(pair->attr, "cname") == 0){
 		rp = cnamerr(entry, pair);
-	else if(cistrcmp(pair->attr, "nullrr") == 0)
+	} else if(cistrcmp(pair->attr, "nullrr") == 0){
 		rp = nullrr(entry, pair);
-	else if(cistrcmp(pair->attr, "txtrr") == 0)
+	} else if(cistrcmp(pair->attr, "txtrr") == 0){
 		rp = txtrr(entry, pair);
-	if(rp == nil)
+	}
+
+	if(rp == 0)
 		return;
 
 	rp->owner = dp;
@@ -610,10 +612,11 @@ dbfile2cache(Ndb *db)
 void
 db2cache(int doit)
 {
-	ulong youngest, temp;
 	Ndb *ndb;
 	Dir *d;
-	static ulong lastcheck, lastyoungest;
+	ulong youngest, temp;
+	static ulong lastcheck;
+	static ulong lastyoungest;
 
 	/* no faster than once every 2 minutes */
 	if(now < lastcheck + 2*Min && !doit)
@@ -638,22 +641,23 @@ db2cache(int doit)
 	for(;;){
 		lastcheck = now;
 		youngest = 0;
-		for(ndb = db; ndb; ndb = ndb->next)
-			/* dirfstat avoids walking the mount table each time */
+		for(ndb = db; ndb; ndb = ndb->next){
+			/* the dirfstat avoids walking the mount table each time */
 			if((d = dirfstat(Bfildes(&ndb->b))) != nil ||
 			   (d = dirstat(ndb->file)) != nil){
-				temp = d->mtime;	/* ulong vs int crap */
+				temp = d->mtime;		/* ulong vs int crap */
 				if(temp > youngest)
 					youngest = temp;
 				free(d);
 			}
+		}
 		if(!doit && youngest == lastyoungest)
 			break;
-
+	
 		/* forget our area definition */
 		freearea(&owned);
 		freearea(&delegated);
-
+	
 		/* reopen all the files (to get oldest for time stamp) */
 		for(ndb = db; ndb; ndb = ndb->next)
 			ndbreopen(ndb);
@@ -661,20 +665,21 @@ db2cache(int doit)
 		if(cachedb){
 			/* mark all db records as timed out */
 			dnagedb();
-
+	
 			/* read in new entries */
 			for(ndb = db; ndb; ndb = ndb->next)
 				dbfile2cache(ndb);
-
+	
 			/* mark as authentic anything in our domain */
 			dnauthdb();
-
+	
 			/* remove old entries */
 			dnageall(1);
-		} else
+		} else {
 			/* read all the soa's to get database defaults */
 			for(ndb = db; ndb; ndb = ndb->next)
 				dbfile2area(ndb);
+		}
 
 		doit = 0;
 		lastyoungest = youngest;
@@ -698,7 +703,7 @@ lookupinfo(char *attr)
 
 	snprint(buf, sizeof buf, "%I", ipaddr);
 	a[0] = attr;
-
+	
 	lock(&dblock);
 	if(opendatabase() < 0){
 		unlock(&dblock);
@@ -709,7 +714,7 @@ lookupinfo(char *attr)
 	return t;
 }
 
-char *localservers =	  "local#dns#servers";
+char *localservers = "local#dns#servers";
 char *localserverprefix = "local#dns#server";
 
 /*
@@ -735,8 +740,7 @@ baddelegation(RR *rp, RR *nsrp, uchar *addr)
 		if(rp->owner != nsrp->owner)
 		if(subsume(rp->owner->name, nsrp->owner->name) &&
 		   strcmp(nsrp->owner->name, localservers) != 0){
-			syslog(0, logfile, "delegation loop %R -> %R from %I",
-				nsrp, rp, addr);
+			syslog(0, logfile, "delegation loop %R -> %R from %I", nsrp, rp, addr);
 			return 1;
 		}
 
@@ -745,8 +749,7 @@ baddelegation(RR *rp, RR *nsrp, uchar *addr)
 			if(rp->host && cistrcmp(rp->host->name, nt->val) == 0)
 				break;
 		if(nt != nil && !inmyarea(rp->owner->name)){
-			syslog(0, logfile, "bad delegation %R from %I",
-				rp, addr);
+			syslog(0, logfile, "bad delegation %R from %I", rp, addr);
 			return 1;
 		}
 	}
@@ -789,12 +792,12 @@ addlocaldnsserver(DN *dp, int class, char *ipaddr, int i)
 RR*
 dnsservers(int class)
 {
-	int i, n;
-	char *p, *buf;
-	char *args[5];
 	Ndbtuple *t, *nt;
 	RR *nsrp;
 	DN *dp;
+	char *p;
+	int i, n;
+	char *buf, *args[5];
 
 	dp = dnlookup(localservers, class, 1);
 	nsrp = rrlookup(dp, Tns, NOneg);
@@ -877,10 +880,12 @@ static void
 createptrs(void)
 {
 	int len, dlen, n;
-	char buf[Domlen+1], ipa[48];
-	char *f[40];
-	uchar net[IPaddrlen], mask[IPaddrlen];
 	Area *s;
+	char *f[40];
+	char buf[Domlen+1];
+	uchar net[IPaddrlen];
+	uchar mask[IPaddrlen];
+	char ipa[48];
 	Ndbtuple *t, *nt;
 
 	dlen = strlen(v4ptrdom);
@@ -923,10 +928,10 @@ createptrs(void)
 			net[IPv4off+3] = atoi(f[0]);
 			sprint(ipa, "%I", net);
 			t = ndbipinfo(db, "ip", ipa, attribs, 1);
-			if(t == nil)	/* could be a reverse with no forward */
+			if(t == nil) /* could be a reverse with no forward */
 				continue;
 			nt = look(t, t, "ipmask");
-			if(nt == nil){		/* we're confused */
+			if(nt == nil){	/* we're confused */
 				ndbfree(t);
 				continue;
 			}
@@ -937,10 +942,7 @@ createptrs(void)
 			continue;
 		}
 
-		/*
-		 * go through all domain entries looking for RR's
-		 * in this network and create ptrs
-		 */
+		/* go through all domain entries looking for RR's in this network and create ptrs */
 		dnptr(net, mask, s->soarr->owner->name, 6-n, 0);
 	}
 }

+ 1142 - 0
sys/src/cmd/ndb/dn.acid

@@ -0,0 +1,1142 @@
+sizeof_1_ = 8;
+aggr _1_
+{
+	'U' 0 lo;
+	'U' 4 hi;
+};
+
+defn
+_1_(addr) {
+	complex _1_ addr;
+	print("	lo	", addr.lo, "\n");
+	print("	hi	", addr.hi, "\n");
+};
+
+sizeofFPdbleword = 8;
+aggr FPdbleword
+{
+	'F' 0 x;
+	{
+	'U' 0 lo;
+	'U' 4 hi;
+	};
+};
+
+defn
+FPdbleword(addr) {
+	complex FPdbleword addr;
+	print("	x	", addr.x, "\n");
+	print("_1_ {\n");
+		_1_(addr+0);
+	print("}\n");
+};
+
+UTFmax = 3;
+Runesync = 128;
+Runeself = 128;
+Runeerror = 65533;
+sizeofFmt = 48;
+aggr Fmt
+{
+	'b' 0 runes;
+	'X' 4 start;
+	'X' 8 to;
+	'X' 12 stop;
+	'X' 16 flush;
+	'X' 20 farg;
+	'D' 24 nfmt;
+	'X' 28 args;
+	'D' 32 r;
+	'D' 36 width;
+	'D' 40 prec;
+	'U' 44 flags;
+};
+
+defn
+Fmt(addr) {
+	complex Fmt addr;
+	print("	runes	", addr.runes, "\n");
+	print("	start	", addr.start\X, "\n");
+	print("	to	", addr.to\X, "\n");
+	print("	stop	", addr.stop\X, "\n");
+	print("	flush	", addr.flush\X, "\n");
+	print("	farg	", addr.farg\X, "\n");
+	print("	nfmt	", addr.nfmt, "\n");
+	print("	args	", addr.args\X, "\n");
+	print("	r	", addr.r, "\n");
+	print("	width	", addr.width, "\n");
+	print("	prec	", addr.prec, "\n");
+	print("	flags	", addr.flags, "\n");
+};
+
+FmtWidth = 1;
+FmtLeft = 2;
+FmtPrec = 4;
+FmtSharp = 8;
+FmtSpace = 16;
+FmtSign = 32;
+FmtZero = 64;
+FmtUnsigned = 128;
+FmtShort = 256;
+FmtLong = 512;
+FmtVLong = 1024;
+FmtComma = 2048;
+FmtByte = 4096;
+FmtFlag = 8192;
+sizeofTm = 40;
+aggr Tm
+{
+	'D' 0 sec;
+	'D' 4 min;
+	'D' 8 hour;
+	'D' 12 mday;
+	'D' 16 mon;
+	'D' 20 year;
+	'D' 24 wday;
+	'D' 28 yday;
+	'a' 32 zone;
+	'D' 36 tzoff;
+};
+
+defn
+Tm(addr) {
+	complex Tm addr;
+	print("	sec	", addr.sec, "\n");
+	print("	min	", addr.