Browse Source

Plan 9 from Bell Labs 2006-01-18

David du Colombier 13 years ago
parent
commit
57b42a0c3b
48 changed files with 1230 additions and 619 deletions
  1. 47 45
      dist/replica/_plan9.db
  2. 47 45
      dist/replica/plan9.db
  3. 84 0
      dist/replica/plan9.log
  4. 28 0
      sys/lib/ghostscript/cidfmap
  5. 24 0
      sys/src/cmd/unix/drawterm/Make.irix
  6. 7 5
      sys/src/cmd/unix/drawterm/include/lib.h
  7. 4 1
      sys/src/cmd/unix/drawterm/include/unix.h
  8. 2 1
      sys/src/cmd/unix/drawterm/kern/devroot.c
  9. 1 1
      sys/src/cmd/unix/drawterm/kern/sysfile.c
  10. 1 0
      sys/src/cmd/unix/drawterm/libc/Makefile
  11. 56 54
      sys/src/cmd/unix/drawterm/libc/charstod.c
  12. 91 63
      sys/src/cmd/unix/drawterm/libc/dofmt.c
  13. 15 2
      sys/src/cmd/unix/drawterm/libc/dorfmt.c
  14. 85 9
      sys/src/cmd/unix/drawterm/libc/fltfmt.c
  15. 78 42
      sys/src/cmd/unix/drawterm/libc/fmt.c
  16. 0 99
      sys/src/cmd/unix/drawterm/libc/fmt.h
  17. 57 25
      sys/src/cmd/unix/drawterm/libc/fmtdef.h
  18. 17 3
      sys/src/cmd/unix/drawterm/libc/fmtfd.c
  19. 33 0
      sys/src/cmd/unix/drawterm/libc/fmtfdflush.c
  20. 2 2
      sys/src/cmd/unix/drawterm/libc/fmtlock.c
  21. 17 3
      sys/src/cmd/unix/drawterm/libc/fmtprint.c
  22. 40 25
      sys/src/cmd/unix/drawterm/libc/fmtquote.c
  23. 15 2
      sys/src/cmd/unix/drawterm/libc/fmtrune.c
  24. 15 1
      sys/src/cmd/unix/drawterm/libc/fmtstr.c
  25. 19 3
      sys/src/cmd/unix/drawterm/libc/fmtvprint.c
  26. 16 2
      sys/src/cmd/unix/drawterm/libc/fprint.c
  27. 25 13
      sys/src/cmd/unix/drawterm/libc/nan64.c
  28. 29 23
      sys/src/cmd/unix/drawterm/libc/pow10.c
  29. 16 2
      sys/src/cmd/unix/drawterm/libc/print.c
  30. 14 0
      sys/src/cmd/unix/drawterm/libc/runefmtstr.c
  31. 14 0
      sys/src/cmd/unix/drawterm/libc/runeseprint.c
  32. 14 0
      sys/src/cmd/unix/drawterm/libc/runesmprint.c
  33. 14 0
      sys/src/cmd/unix/drawterm/libc/runesnprint.c
  34. 14 0
      sys/src/cmd/unix/drawterm/libc/runesprint.c
  35. 17 2
      sys/src/cmd/unix/drawterm/libc/runevseprint.c
  36. 20 6
      sys/src/cmd/unix/drawterm/libc/runevsmprint.c
  37. 16 1
      sys/src/cmd/unix/drawterm/libc/runevsnprint.c
  38. 14 0
      sys/src/cmd/unix/drawterm/libc/seprint.c
  39. 14 0
      sys/src/cmd/unix/drawterm/libc/smprint.c
  40. 14 0
      sys/src/cmd/unix/drawterm/libc/snprint.c
  41. 24 1
      sys/src/cmd/unix/drawterm/libc/sprint.c
  42. 98 104
      sys/src/cmd/unix/drawterm/libc/strtod.c
  43. 16 18
      sys/src/cmd/unix/drawterm/libc/vfprint.c
  44. 18 3
      sys/src/cmd/unix/drawterm/libc/vseprint.c
  45. 21 9
      sys/src/cmd/unix/drawterm/libc/vsmprint.c
  46. 17 2
      sys/src/cmd/unix/drawterm/libc/vsnprint.c
  47. 0 1
      sys/src/cmd/unix/drawterm/libmemdraw/draw.c
  48. 0 1
      sys/src/cmd/unix/drawterm/main.c

+ 47 - 45
dist/replica/_plan9.db

@@ -535,8 +535,8 @@
 386/lib/ape/libl.a - 664 sys sys 1122001337 9420
 386/lib/ape/libnet.a - 664 sys sys 1137468669 16950
 386/lib/ape/libregexp.a - 664 sys sys 1137468669 47670
-386/lib/ape/libutf.a - 664 sys sys 1122001338 81266
-386/lib/ape/libv.a - 664 sys sys 1122001338 19668
+386/lib/ape/libutf.a - 664 sys sys 1137485201 84674
+386/lib/ape/libv.a - 664 sys sys 1137485201 19668
 386/lib/lib9p.a - 664 sys sys 1134389884 91124
 386/lib/libString.a - 664 sys sys 1115950150 22184
 386/lib/libauth.a - 664 sys sys 1128568181 58648
@@ -6248,6 +6248,7 @@ sys/lib/ghostscript/align.ps - 664 sys sys 1137463348 2317
 sys/lib/ghostscript/bdftops.ps - 664 sys sys 1137463349 23410
 sys/lib/ghostscript/caption.ps - 664 sys sys 1137463349 1725
 sys/lib/ghostscript/cid2code.ps - 664 sys sys 1137463349 4479
+sys/lib/ghostscript/cidfmap - 664 sys sys 1137510335 996
 sys/lib/ghostscript/decrypt.ps - 664 sys sys 1137463349 354
 sys/lib/ghostscript/docie.ps - 664 sys sys 1137463349 7123
 sys/lib/ghostscript/dumphint.ps - 775 sys sys 1137463350 20048
@@ -10962,7 +10963,7 @@ sys/src/cmd/gs/src/gconf.h - 664 sys sys 1137462406 1192
 sys/src/cmd/gs/src/gconfig.c - 664 sys sys 1137462407 5494
 sys/src/cmd/gs/src/gconfig.h - 664 sys sys 1137462407 6915
 sys/src/cmd/gs/src/gconfig_.h - 664 sys sys 1137462407 132
-sys/src/cmd/gs/src/gconfigd.h - 644 sys sys 1137462407 275
+sys/src/cmd/gs/src/gconfigd.h - 664 sys sys 1137462407 275
 sys/src/cmd/gs/src/gconfigv.h - 664 sys sys 1015035348 106
 sys/src/cmd/gs/src/gconfxx.h - 664 sys sys 1137462408 6915
 sys/src/cmd/gs/src/gdebug.h - 664 sys sys 1137462408 5416
@@ -13440,6 +13441,7 @@ sys/src/cmd/unix/drawterm/9ball.ico - 664 sys sys 1135900533 9326
 sys/src/cmd/unix/drawterm/9ball.rc - 664 sys sys 1135900533 39
 sys/src/cmd/unix/drawterm/LICENSE - 664 sys sys 1135900534 12184
 sys/src/cmd/unix/drawterm/Make.config - 664 sys sys 1135900534 29
+sys/src/cmd/unix/drawterm/Make.irix - 664 sys sys 1137502401 493
 sys/src/cmd/unix/drawterm/Make.unix - 664 sys sys 1135900534 429
 sys/src/cmd/unix/drawterm/Make.win32 - 664 sys sys 1135900534 816
 sys/src/cmd/unix/drawterm/Makefile - 664 sys sys 1135900534 1112
@@ -13486,14 +13488,14 @@ sys/src/cmd/unix/drawterm/include/draw.h - 664 sys sys 1135900762 16052
 sys/src/cmd/unix/drawterm/include/dtos.h - 664 sys sys 1135900762 358
 sys/src/cmd/unix/drawterm/include/fcall.h - 664 sys sys 1135900762 2676
 sys/src/cmd/unix/drawterm/include/keyboard.h - 664 sys sys 1135900762 920
-sys/src/cmd/unix/drawterm/include/lib.h - 664 sys sys 1135900763 7449
+sys/src/cmd/unix/drawterm/include/lib.h - 664 sys sys 1137506302 7467
 sys/src/cmd/unix/drawterm/include/libc.h - 664 sys sys 1135900763 36
 sys/src/cmd/unix/drawterm/include/libsec.h - 664 sys sys 1135900763 8861
 sys/src/cmd/unix/drawterm/include/memdraw.h - 664 sys sys 1135900763 6306
 sys/src/cmd/unix/drawterm/include/memlayer.h - 664 sys sys 1135900763 1871
 sys/src/cmd/unix/drawterm/include/mp.h - 664 sys sys 1135900763 4524
 sys/src/cmd/unix/drawterm/include/u.h - 664 sys sys 1135900763 336
-sys/src/cmd/unix/drawterm/include/unix.h - 664 sys sys 1135900763 263
+sys/src/cmd/unix/drawterm/include/unix.h - 664 sys sys 1137506303 349
 sys/src/cmd/unix/drawterm/include/user.h - 664 sys sys 1135900764 2532
 sys/src/cmd/unix/drawterm/kern - 20000000775 sys sys 1135900801 0
 sys/src/cmd/unix/drawterm/kern/Makefile - 664 sys sys 1135900764 571
@@ -13515,7 +13517,7 @@ sys/src/cmd/unix/drawterm/kern/devlfd.c - 664 sys sys 1135900766 1534
 sys/src/cmd/unix/drawterm/kern/devmnt.c - 664 sys sys 1135900767 21739
 sys/src/cmd/unix/drawterm/kern/devmouse.c - 664 sys sys 1135900767 3799
 sys/src/cmd/unix/drawterm/kern/devpipe.c - 664 sys sys 1135900767 5927
-sys/src/cmd/unix/drawterm/kern/devroot.c - 664 sys sys 1135900767 4717
+sys/src/cmd/unix/drawterm/kern/devroot.c - 664 sys sys 1137502216 4755
 sys/src/cmd/unix/drawterm/kern/devssl.c - 664 sys sys 1135900767 26455
 sys/src/cmd/unix/drawterm/kern/devtab.c - 664 sys sys 1135900767 470
 sys/src/cmd/unix/drawterm/kern/error.c - 664 sys sys 1135900767 2100
@@ -13536,7 +13538,7 @@ sys/src/cmd/unix/drawterm/kern/sleep.c - 664 sys sys 1135900769 1293
 sys/src/cmd/unix/drawterm/kern/smalloc.c - 664 sys sys 1135900769 187
 sys/src/cmd/unix/drawterm/kern/stub.c - 664 sys sys 1135900770 1273
 sys/src/cmd/unix/drawterm/kern/syscall.c - 664 sys sys 1135900770 12876
-sys/src/cmd/unix/drawterm/kern/sysfile.c - 664 sys sys 1135900770 18035
+sys/src/cmd/unix/drawterm/kern/sysfile.c - 664 sys sys 1137502217 18037
 sys/src/cmd/unix/drawterm/kern/sysproc.c - 664 sys sys 1135900770 498
 sys/src/cmd/unix/drawterm/kern/term.c - 664 sys sys 1135900770 3962
 sys/src/cmd/unix/drawterm/kern/todo.c - 664 sys sys 1135900770 0
@@ -13574,8 +13576,8 @@ sys/src/cmd/unix/drawterm/libauthsrv/opasstokey.c - 664 sys sys 1135900562 448
 sys/src/cmd/unix/drawterm/libauthsrv/passtokey.c - 664 sys sys 1135900562 517
 sys/src/cmd/unix/drawterm/libauthsrv/readnvram.c - 664 sys sys 1135900562 8446
 sys/src/cmd/unix/drawterm/libc - 20000000775 sys sys 1135900573 0
-sys/src/cmd/unix/drawterm/libc/Makefile - 664 sys sys 1135900562 1097
-sys/src/cmd/unix/drawterm/libc/charstod.c - 664 sys sys 1135900562 1661
+sys/src/cmd/unix/drawterm/libc/Makefile - 664 sys sys 1137502398 1113
+sys/src/cmd/unix/drawterm/libc/charstod.c - 664 sys sys 1137506307 1954
 sys/src/cmd/unix/drawterm/libc/cleanname.c - 664 sys sys 1135900562 1199
 sys/src/cmd/unix/drawterm/libc/convD2M.c - 664 sys sys 1135900562 1398
 sys/src/cmd/unix/drawterm/libc/convM2D.c - 664 sys sys 1135900563 1419
@@ -13588,22 +13590,22 @@ sys/src/cmd/unix/drawterm/libc/dirfwstat.c - 664 sys sys 1135900563 242
 sys/src/cmd/unix/drawterm/libc/dirmodefmt.c - 664 sys sys 1135900563 581
 sys/src/cmd/unix/drawterm/libc/dirstat.c - 664 sys sys 1135900563 688
 sys/src/cmd/unix/drawterm/libc/dirwstat.c - 664 sys sys 1135900564 246
-sys/src/cmd/unix/drawterm/libc/dofmt.c - 664 sys sys 1135900564 8626
-sys/src/cmd/unix/drawterm/libc/dorfmt.c - 664 sys sys 1135900564 777
+sys/src/cmd/unix/drawterm/libc/dofmt.c - 664 sys sys 1137506308 9771
+sys/src/cmd/unix/drawterm/libc/dorfmt.c - 664 sys sys 1137506308 1542
 sys/src/cmd/unix/drawterm/libc/errfmt.c - 664 sys sys 1135900564 175
 sys/src/cmd/unix/drawterm/libc/fcallfmt.c - 664 sys sys 1135900564 5740
-sys/src/cmd/unix/drawterm/libc/fltfmt.c - 664 sys sys 1135900564 4345
-sys/src/cmd/unix/drawterm/libc/fmt.c - 664 sys sys 1135900564 2940
-sys/src/cmd/unix/drawterm/libc/fmt.h - 664 sys sys 1135900565 3075
-sys/src/cmd/unix/drawterm/libc/fmtdef.h - 664 sys sys 1135900565 1808
-sys/src/cmd/unix/drawterm/libc/fmtfd.c - 664 sys sys 1135900565 508
-sys/src/cmd/unix/drawterm/libc/fmtlock.c - 664 sys sys 1135900565 134
-sys/src/cmd/unix/drawterm/libc/fmtprint.c - 664 sys sys 1135900565 465
-sys/src/cmd/unix/drawterm/libc/fmtquote.c - 664 sys sys 1135900565 4732
-sys/src/cmd/unix/drawterm/libc/fmtrune.c - 664 sys sys 1135900565 314
-sys/src/cmd/unix/drawterm/libc/fmtstr.c - 664 sys sys 1135900565 140
-sys/src/cmd/unix/drawterm/libc/fmtvprint.c - 664 sys sys 1135900565 449
-sys/src/cmd/unix/drawterm/libc/fprint.c - 664 sys sys 1135900566 174
+sys/src/cmd/unix/drawterm/libc/fltfmt.c - 664 sys sys 1137506308 7053
+sys/src/cmd/unix/drawterm/libc/fmt.c - 664 sys sys 1137506308 4195
+sys/src/cmd/unix/drawterm/libc/fmtdef.h - 664 sys sys 1137506309 3466
+sys/src/cmd/unix/drawterm/libc/fmtfd.c - 664 sys sys 1137502221 1294
+sys/src/cmd/unix/drawterm/libc/fmtfdflush.c - 664 sys sys 1137502221 1081
+sys/src/cmd/unix/drawterm/libc/fmtlock.c - 664 sys sys 1137506309 136
+sys/src/cmd/unix/drawterm/libc/fmtprint.c - 664 sys sys 1137506309 1261
+sys/src/cmd/unix/drawterm/libc/fmtquote.c - 664 sys sys 1137506309 5514
+sys/src/cmd/unix/drawterm/libc/fmtrune.c - 664 sys sys 1137506309 1079
+sys/src/cmd/unix/drawterm/libc/fmtstr.c - 664 sys sys 1137506310 918
+sys/src/cmd/unix/drawterm/libc/fmtvprint.c - 664 sys sys 1137506310 1270
+sys/src/cmd/unix/drawterm/libc/fprint.c - 664 sys sys 1137506310 945
 sys/src/cmd/unix/drawterm/libc/frand.c - 664 sys sys 1135900566 210
 sys/src/cmd/unix/drawterm/libc/getfields.c - 664 sys sys 1135900566 516
 sys/src/cmd/unix/drawterm/libc/getpid.c - 664 sys sys 1135900566 198
@@ -13612,22 +13614,22 @@ sys/src/cmd/unix/drawterm/libc/lock.c - 664 sys sys 1135900566 774
 sys/src/cmd/unix/drawterm/libc/lrand.c - 664 sys sys 1135900566 1109
 sys/src/cmd/unix/drawterm/libc/mallocz.c - 664 sys sys 1135900566 141
 sys/src/cmd/unix/drawterm/libc/nan.h - 664 sys sys 1135900566 114
-sys/src/cmd/unix/drawterm/libc/nan64.c - 664 sys sys 1135900567 921
+sys/src/cmd/unix/drawterm/libc/nan64.c - 664 sys sys 1137506310 1051
 sys/src/cmd/unix/drawterm/libc/netmkaddr.c - 664 sys sys 1135900567 863
 sys/src/cmd/unix/drawterm/libc/nrand.c - 664 sys sys 1135900567 191
 sys/src/cmd/unix/drawterm/libc/nsec.c - 664 sys sys 1135900567 1196
-sys/src/cmd/unix/drawterm/libc/pow10.c - 664 sys sys 1135900567 1946
-sys/src/cmd/unix/drawterm/libc/print.c - 664 sys sys 1135900567 164
+sys/src/cmd/unix/drawterm/libc/pow10.c - 664 sys sys 1137506311 1946
+sys/src/cmd/unix/drawterm/libc/print.c - 664 sys sys 1137506311 935
 sys/src/cmd/unix/drawterm/libc/pushssl.c - 664 sys sys 1135900567 905
 sys/src/cmd/unix/drawterm/libc/rand.c - 664 sys sys 1135900567 79
 sys/src/cmd/unix/drawterm/libc/read9pmsg.c - 664 sys sys 1135900567 462
 sys/src/cmd/unix/drawterm/libc/readn.c - 664 sys sys 1135900568 234
 sys/src/cmd/unix/drawterm/libc/rune.c - 664 sys sys 1135900568 2306
-sys/src/cmd/unix/drawterm/libc/runefmtstr.c - 664 sys sys 1135900568 144
-sys/src/cmd/unix/drawterm/libc/runeseprint.c - 664 sys sys 1135900568 204
-sys/src/cmd/unix/drawterm/libc/runesmprint.c - 664 sys sys 1135900568 176
-sys/src/cmd/unix/drawterm/libc/runesnprint.c - 664 sys sys 1135900568 203
-sys/src/cmd/unix/drawterm/libc/runesprint.c - 664 sys sys 1135900568 192
+sys/src/cmd/unix/drawterm/libc/runefmtstr.c - 664 sys sys 1137506312 915
+sys/src/cmd/unix/drawterm/libc/runeseprint.c - 664 sys sys 1137506312 975
+sys/src/cmd/unix/drawterm/libc/runesmprint.c - 664 sys sys 1137506312 947
+sys/src/cmd/unix/drawterm/libc/runesnprint.c - 664 sys sys 1137506312 974
+sys/src/cmd/unix/drawterm/libc/runesprint.c - 664 sys sys 1137506312 963
 sys/src/cmd/unix/drawterm/libc/runestrcat.c - 664 sys sys 1135900568 124
 sys/src/cmd/unix/drawterm/libc/runestrchr.c - 664 sys sys 1135900568 207
 sys/src/cmd/unix/drawterm/libc/runestrcmp.c - 664 sys sys 1135900569 221
@@ -13641,15 +13643,15 @@ sys/src/cmd/unix/drawterm/libc/runestrncpy.c - 664 sys sys 1135900569 234
 sys/src/cmd/unix/drawterm/libc/runestrrchr.c - 664 sys sys 1135900569 182
 sys/src/cmd/unix/drawterm/libc/runestrstr.c - 664 sys sys 1135900570 397
 sys/src/cmd/unix/drawterm/libc/runetype.c - 664 sys sys 1135900570 29655
-sys/src/cmd/unix/drawterm/libc/runevseprint.c - 664 sys sys 1135900570 313
-sys/src/cmd/unix/drawterm/libc/runevsmprint.c - 664 sys sys 1135900570 1043
-sys/src/cmd/unix/drawterm/libc/runevsnprint.c - 664 sys sys 1135900570 330
-sys/src/cmd/unix/drawterm/libc/seprint.c - 664 sys sys 1135900570 196
-sys/src/cmd/unix/drawterm/libc/smprint.c - 664 sys sys 1135900570 168
-sys/src/cmd/unix/drawterm/libc/snprint.c - 664 sys sys 1135900570 195
-sys/src/cmd/unix/drawterm/libc/sprint.c - 664 sys sys 1135900570 236
+sys/src/cmd/unix/drawterm/libc/runevseprint.c - 664 sys sys 1137506313 1115
+sys/src/cmd/unix/drawterm/libc/runevsmprint.c - 664 sys sys 1137506313 1854
+sys/src/cmd/unix/drawterm/libc/runevsnprint.c - 664 sys sys 1137506314 1125
+sys/src/cmd/unix/drawterm/libc/seprint.c - 664 sys sys 1137506314 967
+sys/src/cmd/unix/drawterm/libc/smprint.c - 664 sys sys 1137506314 939
+sys/src/cmd/unix/drawterm/libc/snprint.c - 664 sys sys 1137506314 966
+sys/src/cmd/unix/drawterm/libc/sprint.c - 664 sys sys 1137506315 1195
 sys/src/cmd/unix/drawterm/libc/strecpy.c - 664 sys sys 1135900571 223
-sys/src/cmd/unix/drawterm/libc/strtod.c - 664 sys sys 1135900571 8558
+sys/src/cmd/unix/drawterm/libc/strtod.c - 664 sys sys 1137506315 9114
 sys/src/cmd/unix/drawterm/libc/strtod.h - 664 sys sys 1135900571 120
 sys/src/cmd/unix/drawterm/libc/strtoll.c - 664 sys sys 1135900571 1302
 sys/src/cmd/unix/drawterm/libc/sysfatal.c - 664 sys sys 1135900571 479
@@ -13667,10 +13669,10 @@ sys/src/cmd/unix/drawterm/libc/utfnlen.c - 664 sys sys 1135900572 317
 sys/src/cmd/unix/drawterm/libc/utfrrune.c - 664 sys sys 1135900572 414
 sys/src/cmd/unix/drawterm/libc/utfrune.c - 664 sys sys 1135900572 401
 sys/src/cmd/unix/drawterm/libc/utfutf.c - 664 sys sys 1135900573 391
-sys/src/cmd/unix/drawterm/libc/vfprint.c - 664 sys sys 1135900573 518
-sys/src/cmd/unix/drawterm/libc/vseprint.c - 664 sys sys 1135900573 309
-sys/src/cmd/unix/drawterm/libc/vsmprint.c - 664 sys sys 1135900573 997
-sys/src/cmd/unix/drawterm/libc/vsnprint.c - 664 sys sys 1135900573 326
+sys/src/cmd/unix/drawterm/libc/vfprint.c - 664 sys sys 1137506316 1046
+sys/src/cmd/unix/drawterm/libc/vseprint.c - 664 sys sys 1137506316 1109
+sys/src/cmd/unix/drawterm/libc/vsmprint.c - 664 sys sys 1137506316 1754
+sys/src/cmd/unix/drawterm/libc/vsnprint.c - 664 sys sys 1137506317 1119
 sys/src/cmd/unix/drawterm/libdraw - 20000000775 sys sys 954098713 0
 sys/src/cmd/unix/drawterm/libdraw/Makefile - 664 sys sys 1135900573 293
 sys/src/cmd/unix/drawterm/libdraw/alloc.c - 664 sys sys 1135900573 4095
@@ -13693,7 +13695,7 @@ sys/src/cmd/unix/drawterm/libmemdraw/cload.c - 664 sys sys 1135900576 1338
 sys/src/cmd/unix/drawterm/libmemdraw/cmap.c - 664 sys sys 1135900576 25150
 sys/src/cmd/unix/drawterm/libmemdraw/cread.c - 664 sys sys 1135900576 1982
 sys/src/cmd/unix/drawterm/libmemdraw/defont.c - 664 sys sys 1135900576 1293
-sys/src/cmd/unix/drawterm/libmemdraw/draw.c - 664 sys sys 1135900576 54684
+sys/src/cmd/unix/drawterm/libmemdraw/draw.c - 664 sys sys 1137502231 54659
 sys/src/cmd/unix/drawterm/libmemdraw/drawtest.c - 664 sys sys 1135900576 23441
 sys/src/cmd/unix/drawterm/libmemdraw/ellipse.c - 664 sys sys 1135900576 4864
 sys/src/cmd/unix/drawterm/libmemdraw/fillpoly.c - 664 sys sys 1135900576 9973
@@ -13820,7 +13822,7 @@ sys/src/cmd/unix/drawterm/libsec/smallprimetest.c - 664 sys sys 1135900591 70640
 sys/src/cmd/unix/drawterm/libsec/thumb.c - 664 sys sys 1135900592 1891
 sys/src/cmd/unix/drawterm/libsec/tlshand.c - 664 sys sys 1135900592 53926
 sys/src/cmd/unix/drawterm/libsec/x509.c - 664 sys sys 1135900592 50237
-sys/src/cmd/unix/drawterm/main.c - 664 sys sys 1135900536 2440
+sys/src/cmd/unix/drawterm/main.c - 664 sys sys 1137502212 2414
 sys/src/cmd/unix/drawterm/posix-386 - 20000000775 sys sys 1135900540 0
 sys/src/cmd/unix/drawterm/posix-386/Makefile - 664 sys sys 1135900540 378
 sys/src/cmd/unix/drawterm/posix-386/getcallerpc.c - 664 sys sys 1135900540 90

+ 47 - 45
dist/replica/plan9.db

@@ -535,8 +535,8 @@
 386/lib/ape/libl.a - 664 sys sys 1122001337 9420
 386/lib/ape/libnet.a - 664 sys sys 1137468669 16950
 386/lib/ape/libregexp.a - 664 sys sys 1137468669 47670
-386/lib/ape/libutf.a - 664 sys sys 1122001338 81266
-386/lib/ape/libv.a - 664 sys sys 1122001338 19668
+386/lib/ape/libutf.a - 664 sys sys 1137485201 84674
+386/lib/ape/libv.a - 664 sys sys 1137485201 19668
 386/lib/lib9p.a - 664 sys sys 1134389884 91124
 386/lib/libString.a - 664 sys sys 1115950150 22184
 386/lib/libauth.a - 664 sys sys 1128568181 58648
@@ -6248,6 +6248,7 @@ sys/lib/ghostscript/align.ps - 664 sys sys 1137463348 2317
 sys/lib/ghostscript/bdftops.ps - 664 sys sys 1137463349 23410
 sys/lib/ghostscript/caption.ps - 664 sys sys 1137463349 1725
 sys/lib/ghostscript/cid2code.ps - 664 sys sys 1137463349 4479
+sys/lib/ghostscript/cidfmap - 664 sys sys 1137510335 996
 sys/lib/ghostscript/decrypt.ps - 664 sys sys 1137463349 354
 sys/lib/ghostscript/docie.ps - 664 sys sys 1137463349 7123
 sys/lib/ghostscript/dumphint.ps - 775 sys sys 1137463350 20048
@@ -10962,7 +10963,7 @@ sys/src/cmd/gs/src/gconf.h - 664 sys sys 1137462406 1192
 sys/src/cmd/gs/src/gconfig.c - 664 sys sys 1137462407 5494
 sys/src/cmd/gs/src/gconfig.h - 664 sys sys 1137462407 6915
 sys/src/cmd/gs/src/gconfig_.h - 664 sys sys 1137462407 132
-sys/src/cmd/gs/src/gconfigd.h - 644 sys sys 1137462407 275
+sys/src/cmd/gs/src/gconfigd.h - 664 sys sys 1137462407 275
 sys/src/cmd/gs/src/gconfigv.h - 664 sys sys 1015035348 106
 sys/src/cmd/gs/src/gconfxx.h - 664 sys sys 1137462408 6915
 sys/src/cmd/gs/src/gdebug.h - 664 sys sys 1137462408 5416
@@ -13440,6 +13441,7 @@ sys/src/cmd/unix/drawterm/9ball.ico - 664 sys sys 1135900533 9326
 sys/src/cmd/unix/drawterm/9ball.rc - 664 sys sys 1135900533 39
 sys/src/cmd/unix/drawterm/LICENSE - 664 sys sys 1135900534 12184
 sys/src/cmd/unix/drawterm/Make.config - 664 sys sys 1135900534 29
+sys/src/cmd/unix/drawterm/Make.irix - 664 sys sys 1137502401 493
 sys/src/cmd/unix/drawterm/Make.unix - 664 sys sys 1135900534 429
 sys/src/cmd/unix/drawterm/Make.win32 - 664 sys sys 1135900534 816
 sys/src/cmd/unix/drawterm/Makefile - 664 sys sys 1135900534 1112
@@ -13486,14 +13488,14 @@ sys/src/cmd/unix/drawterm/include/draw.h - 664 sys sys 1135900762 16052
 sys/src/cmd/unix/drawterm/include/dtos.h - 664 sys sys 1135900762 358
 sys/src/cmd/unix/drawterm/include/fcall.h - 664 sys sys 1135900762 2676
 sys/src/cmd/unix/drawterm/include/keyboard.h - 664 sys sys 1135900762 920
-sys/src/cmd/unix/drawterm/include/lib.h - 664 sys sys 1135900763 7449
+sys/src/cmd/unix/drawterm/include/lib.h - 664 sys sys 1137506302 7467
 sys/src/cmd/unix/drawterm/include/libc.h - 664 sys sys 1135900763 36
 sys/src/cmd/unix/drawterm/include/libsec.h - 664 sys sys 1135900763 8861
 sys/src/cmd/unix/drawterm/include/memdraw.h - 664 sys sys 1135900763 6306
 sys/src/cmd/unix/drawterm/include/memlayer.h - 664 sys sys 1135900763 1871
 sys/src/cmd/unix/drawterm/include/mp.h - 664 sys sys 1135900763 4524
 sys/src/cmd/unix/drawterm/include/u.h - 664 sys sys 1135900763 336
-sys/src/cmd/unix/drawterm/include/unix.h - 664 sys sys 1135900763 263
+sys/src/cmd/unix/drawterm/include/unix.h - 664 sys sys 1137506303 349
 sys/src/cmd/unix/drawterm/include/user.h - 664 sys sys 1135900764 2532
 sys/src/cmd/unix/drawterm/kern - 20000000775 sys sys 1135900801 0
 sys/src/cmd/unix/drawterm/kern/Makefile - 664 sys sys 1135900764 571
@@ -13515,7 +13517,7 @@ sys/src/cmd/unix/drawterm/kern/devlfd.c - 664 sys sys 1135900766 1534
 sys/src/cmd/unix/drawterm/kern/devmnt.c - 664 sys sys 1135900767 21739
 sys/src/cmd/unix/drawterm/kern/devmouse.c - 664 sys sys 1135900767 3799
 sys/src/cmd/unix/drawterm/kern/devpipe.c - 664 sys sys 1135900767 5927
-sys/src/cmd/unix/drawterm/kern/devroot.c - 664 sys sys 1135900767 4717
+sys/src/cmd/unix/drawterm/kern/devroot.c - 664 sys sys 1137502216 4755
 sys/src/cmd/unix/drawterm/kern/devssl.c - 664 sys sys 1135900767 26455
 sys/src/cmd/unix/drawterm/kern/devtab.c - 664 sys sys 1135900767 470
 sys/src/cmd/unix/drawterm/kern/error.c - 664 sys sys 1135900767 2100
@@ -13536,7 +13538,7 @@ sys/src/cmd/unix/drawterm/kern/sleep.c - 664 sys sys 1135900769 1293
 sys/src/cmd/unix/drawterm/kern/smalloc.c - 664 sys sys 1135900769 187
 sys/src/cmd/unix/drawterm/kern/stub.c - 664 sys sys 1135900770 1273
 sys/src/cmd/unix/drawterm/kern/syscall.c - 664 sys sys 1135900770 12876
-sys/src/cmd/unix/drawterm/kern/sysfile.c - 664 sys sys 1135900770 18035
+sys/src/cmd/unix/drawterm/kern/sysfile.c - 664 sys sys 1137502217 18037
 sys/src/cmd/unix/drawterm/kern/sysproc.c - 664 sys sys 1135900770 498
 sys/src/cmd/unix/drawterm/kern/term.c - 664 sys sys 1135900770 3962
 sys/src/cmd/unix/drawterm/kern/todo.c - 664 sys sys 1135900770 0
@@ -13574,8 +13576,8 @@ sys/src/cmd/unix/drawterm/libauthsrv/opasstokey.c - 664 sys sys 1135900562 448
 sys/src/cmd/unix/drawterm/libauthsrv/passtokey.c - 664 sys sys 1135900562 517
 sys/src/cmd/unix/drawterm/libauthsrv/readnvram.c - 664 sys sys 1135900562 8446
 sys/src/cmd/unix/drawterm/libc - 20000000775 sys sys 1135900573 0
-sys/src/cmd/unix/drawterm/libc/Makefile - 664 sys sys 1135900562 1097
-sys/src/cmd/unix/drawterm/libc/charstod.c - 664 sys sys 1135900562 1661
+sys/src/cmd/unix/drawterm/libc/Makefile - 664 sys sys 1137502398 1113
+sys/src/cmd/unix/drawterm/libc/charstod.c - 664 sys sys 1137506307 1954
 sys/src/cmd/unix/drawterm/libc/cleanname.c - 664 sys sys 1135900562 1199
 sys/src/cmd/unix/drawterm/libc/convD2M.c - 664 sys sys 1135900562 1398
 sys/src/cmd/unix/drawterm/libc/convM2D.c - 664 sys sys 1135900563 1419
@@ -13588,22 +13590,22 @@ sys/src/cmd/unix/drawterm/libc/dirfwstat.c - 664 sys sys 1135900563 242
 sys/src/cmd/unix/drawterm/libc/dirmodefmt.c - 664 sys sys 1135900563 581
 sys/src/cmd/unix/drawterm/libc/dirstat.c - 664 sys sys 1135900563 688
 sys/src/cmd/unix/drawterm/libc/dirwstat.c - 664 sys sys 1135900564 246
-sys/src/cmd/unix/drawterm/libc/dofmt.c - 664 sys sys 1135900564 8626
-sys/src/cmd/unix/drawterm/libc/dorfmt.c - 664 sys sys 1135900564 777
+sys/src/cmd/unix/drawterm/libc/dofmt.c - 664 sys sys 1137506308 9771
+sys/src/cmd/unix/drawterm/libc/dorfmt.c - 664 sys sys 1137506308 1542
 sys/src/cmd/unix/drawterm/libc/errfmt.c - 664 sys sys 1135900564 175
 sys/src/cmd/unix/drawterm/libc/fcallfmt.c - 664 sys sys 1135900564 5740
-sys/src/cmd/unix/drawterm/libc/fltfmt.c - 664 sys sys 1135900564 4345
-sys/src/cmd/unix/drawterm/libc/fmt.c - 664 sys sys 1135900564 2940
-sys/src/cmd/unix/drawterm/libc/fmt.h - 664 sys sys 1135900565 3075
-sys/src/cmd/unix/drawterm/libc/fmtdef.h - 664 sys sys 1135900565 1808
-sys/src/cmd/unix/drawterm/libc/fmtfd.c - 664 sys sys 1135900565 508
-sys/src/cmd/unix/drawterm/libc/fmtlock.c - 664 sys sys 1135900565 134
-sys/src/cmd/unix/drawterm/libc/fmtprint.c - 664 sys sys 1135900565 465
-sys/src/cmd/unix/drawterm/libc/fmtquote.c - 664 sys sys 1135900565 4732
-sys/src/cmd/unix/drawterm/libc/fmtrune.c - 664 sys sys 1135900565 314
-sys/src/cmd/unix/drawterm/libc/fmtstr.c - 664 sys sys 1135900565 140
-sys/src/cmd/unix/drawterm/libc/fmtvprint.c - 664 sys sys 1135900565 449
-sys/src/cmd/unix/drawterm/libc/fprint.c - 664 sys sys 1135900566 174
+sys/src/cmd/unix/drawterm/libc/fltfmt.c - 664 sys sys 1137506308 7053
+sys/src/cmd/unix/drawterm/libc/fmt.c - 664 sys sys 1137506308 4195
+sys/src/cmd/unix/drawterm/libc/fmtdef.h - 664 sys sys 1137506309 3466
+sys/src/cmd/unix/drawterm/libc/fmtfd.c - 664 sys sys 1137502221 1294
+sys/src/cmd/unix/drawterm/libc/fmtfdflush.c - 664 sys sys 1137502221 1081
+sys/src/cmd/unix/drawterm/libc/fmtlock.c - 664 sys sys 1137506309 136
+sys/src/cmd/unix/drawterm/libc/fmtprint.c - 664 sys sys 1137506309 1261
+sys/src/cmd/unix/drawterm/libc/fmtquote.c - 664 sys sys 1137506309 5514
+sys/src/cmd/unix/drawterm/libc/fmtrune.c - 664 sys sys 1137506309 1079
+sys/src/cmd/unix/drawterm/libc/fmtstr.c - 664 sys sys 1137506310 918
+sys/src/cmd/unix/drawterm/libc/fmtvprint.c - 664 sys sys 1137506310 1270
+sys/src/cmd/unix/drawterm/libc/fprint.c - 664 sys sys 1137506310 945
 sys/src/cmd/unix/drawterm/libc/frand.c - 664 sys sys 1135900566 210
 sys/src/cmd/unix/drawterm/libc/getfields.c - 664 sys sys 1135900566 516
 sys/src/cmd/unix/drawterm/libc/getpid.c - 664 sys sys 1135900566 198
@@ -13612,22 +13614,22 @@ sys/src/cmd/unix/drawterm/libc/lock.c - 664 sys sys 1135900566 774
 sys/src/cmd/unix/drawterm/libc/lrand.c - 664 sys sys 1135900566 1109
 sys/src/cmd/unix/drawterm/libc/mallocz.c - 664 sys sys 1135900566 141
 sys/src/cmd/unix/drawterm/libc/nan.h - 664 sys sys 1135900566 114
-sys/src/cmd/unix/drawterm/libc/nan64.c - 664 sys sys 1135900567 921
+sys/src/cmd/unix/drawterm/libc/nan64.c - 664 sys sys 1137506310 1051
 sys/src/cmd/unix/drawterm/libc/netmkaddr.c - 664 sys sys 1135900567 863
 sys/src/cmd/unix/drawterm/libc/nrand.c - 664 sys sys 1135900567 191
 sys/src/cmd/unix/drawterm/libc/nsec.c - 664 sys sys 1135900567 1196
-sys/src/cmd/unix/drawterm/libc/pow10.c - 664 sys sys 1135900567 1946
-sys/src/cmd/unix/drawterm/libc/print.c - 664 sys sys 1135900567 164
+sys/src/cmd/unix/drawterm/libc/pow10.c - 664 sys sys 1137506311 1946
+sys/src/cmd/unix/drawterm/libc/print.c - 664 sys sys 1137506311 935
 sys/src/cmd/unix/drawterm/libc/pushssl.c - 664 sys sys 1135900567 905
 sys/src/cmd/unix/drawterm/libc/rand.c - 664 sys sys 1135900567 79
 sys/src/cmd/unix/drawterm/libc/read9pmsg.c - 664 sys sys 1135900567 462
 sys/src/cmd/unix/drawterm/libc/readn.c - 664 sys sys 1135900568 234
 sys/src/cmd/unix/drawterm/libc/rune.c - 664 sys sys 1135900568 2306
-sys/src/cmd/unix/drawterm/libc/runefmtstr.c - 664 sys sys 1135900568 144
-sys/src/cmd/unix/drawterm/libc/runeseprint.c - 664 sys sys 1135900568 204
-sys/src/cmd/unix/drawterm/libc/runesmprint.c - 664 sys sys 1135900568 176
-sys/src/cmd/unix/drawterm/libc/runesnprint.c - 664 sys sys 1135900568 203
-sys/src/cmd/unix/drawterm/libc/runesprint.c - 664 sys sys 1135900568 192
+sys/src/cmd/unix/drawterm/libc/runefmtstr.c - 664 sys sys 1137506312 915
+sys/src/cmd/unix/drawterm/libc/runeseprint.c - 664 sys sys 1137506312 975
+sys/src/cmd/unix/drawterm/libc/runesmprint.c - 664 sys sys 1137506312 947
+sys/src/cmd/unix/drawterm/libc/runesnprint.c - 664 sys sys 1137506312 974
+sys/src/cmd/unix/drawterm/libc/runesprint.c - 664 sys sys 1137506312 963
 sys/src/cmd/unix/drawterm/libc/runestrcat.c - 664 sys sys 1135900568 124
 sys/src/cmd/unix/drawterm/libc/runestrchr.c - 664 sys sys 1135900568 207
 sys/src/cmd/unix/drawterm/libc/runestrcmp.c - 664 sys sys 1135900569 221
@@ -13641,15 +13643,15 @@ sys/src/cmd/unix/drawterm/libc/runestrncpy.c - 664 sys sys 1135900569 234
 sys/src/cmd/unix/drawterm/libc/runestrrchr.c - 664 sys sys 1135900569 182
 sys/src/cmd/unix/drawterm/libc/runestrstr.c - 664 sys sys 1135900570 397
 sys/src/cmd/unix/drawterm/libc/runetype.c - 664 sys sys 1135900570 29655
-sys/src/cmd/unix/drawterm/libc/runevseprint.c - 664 sys sys 1135900570 313
-sys/src/cmd/unix/drawterm/libc/runevsmprint.c - 664 sys sys 1135900570 1043
-sys/src/cmd/unix/drawterm/libc/runevsnprint.c - 664 sys sys 1135900570 330
-sys/src/cmd/unix/drawterm/libc/seprint.c - 664 sys sys 1135900570 196
-sys/src/cmd/unix/drawterm/libc/smprint.c - 664 sys sys 1135900570 168
-sys/src/cmd/unix/drawterm/libc/snprint.c - 664 sys sys 1135900570 195
-sys/src/cmd/unix/drawterm/libc/sprint.c - 664 sys sys 1135900570 236
+sys/src/cmd/unix/drawterm/libc/runevseprint.c - 664 sys sys 1137506313 1115
+sys/src/cmd/unix/drawterm/libc/runevsmprint.c - 664 sys sys 1137506313 1854
+sys/src/cmd/unix/drawterm/libc/runevsnprint.c - 664 sys sys 1137506314 1125
+sys/src/cmd/unix/drawterm/libc/seprint.c - 664 sys sys 1137506314 967
+sys/src/cmd/unix/drawterm/libc/smprint.c - 664 sys sys 1137506314 939
+sys/src/cmd/unix/drawterm/libc/snprint.c - 664 sys sys 1137506314 966
+sys/src/cmd/unix/drawterm/libc/sprint.c - 664 sys sys 1137506315 1195
 sys/src/cmd/unix/drawterm/libc/strecpy.c - 664 sys sys 1135900571 223
-sys/src/cmd/unix/drawterm/libc/strtod.c - 664 sys sys 1135900571 8558
+sys/src/cmd/unix/drawterm/libc/strtod.c - 664 sys sys 1137506315 9114
 sys/src/cmd/unix/drawterm/libc/strtod.h - 664 sys sys 1135900571 120
 sys/src/cmd/unix/drawterm/libc/strtoll.c - 664 sys sys 1135900571 1302
 sys/src/cmd/unix/drawterm/libc/sysfatal.c - 664 sys sys 1135900571 479
@@ -13667,10 +13669,10 @@ sys/src/cmd/unix/drawterm/libc/utfnlen.c - 664 sys sys 1135900572 317
 sys/src/cmd/unix/drawterm/libc/utfrrune.c - 664 sys sys 1135900572 414
 sys/src/cmd/unix/drawterm/libc/utfrune.c - 664 sys sys 1135900572 401
 sys/src/cmd/unix/drawterm/libc/utfutf.c - 664 sys sys 1135900573 391
-sys/src/cmd/unix/drawterm/libc/vfprint.c - 664 sys sys 1135900573 518
-sys/src/cmd/unix/drawterm/libc/vseprint.c - 664 sys sys 1135900573 309
-sys/src/cmd/unix/drawterm/libc/vsmprint.c - 664 sys sys 1135900573 997
-sys/src/cmd/unix/drawterm/libc/vsnprint.c - 664 sys sys 1135900573 326
+sys/src/cmd/unix/drawterm/libc/vfprint.c - 664 sys sys 1137506316 1046
+sys/src/cmd/unix/drawterm/libc/vseprint.c - 664 sys sys 1137506316 1109
+sys/src/cmd/unix/drawterm/libc/vsmprint.c - 664 sys sys 1137506316 1754
+sys/src/cmd/unix/drawterm/libc/vsnprint.c - 664 sys sys 1137506317 1119
 sys/src/cmd/unix/drawterm/libdraw - 20000000775 sys sys 954098713 0
 sys/src/cmd/unix/drawterm/libdraw/Makefile - 664 sys sys 1135900573 293
 sys/src/cmd/unix/drawterm/libdraw/alloc.c - 664 sys sys 1135900573 4095
@@ -13693,7 +13695,7 @@ sys/src/cmd/unix/drawterm/libmemdraw/cload.c - 664 sys sys 1135900576 1338
 sys/src/cmd/unix/drawterm/libmemdraw/cmap.c - 664 sys sys 1135900576 25150
 sys/src/cmd/unix/drawterm/libmemdraw/cread.c - 664 sys sys 1135900576 1982
 sys/src/cmd/unix/drawterm/libmemdraw/defont.c - 664 sys sys 1135900576 1293
-sys/src/cmd/unix/drawterm/libmemdraw/draw.c - 664 sys sys 1135900576 54684
+sys/src/cmd/unix/drawterm/libmemdraw/draw.c - 664 sys sys 1137502231 54659
 sys/src/cmd/unix/drawterm/libmemdraw/drawtest.c - 664 sys sys 1135900576 23441
 sys/src/cmd/unix/drawterm/libmemdraw/ellipse.c - 664 sys sys 1135900576 4864
 sys/src/cmd/unix/drawterm/libmemdraw/fillpoly.c - 664 sys sys 1135900576 9973
@@ -13820,7 +13822,7 @@ sys/src/cmd/unix/drawterm/libsec/smallprimetest.c - 664 sys sys 1135900591 70640
 sys/src/cmd/unix/drawterm/libsec/thumb.c - 664 sys sys 1135900592 1891
 sys/src/cmd/unix/drawterm/libsec/tlshand.c - 664 sys sys 1135900592 53926
 sys/src/cmd/unix/drawterm/libsec/x509.c - 664 sys sys 1135900592 50237
-sys/src/cmd/unix/drawterm/main.c - 664 sys sys 1135900536 2440
+sys/src/cmd/unix/drawterm/main.c - 664 sys sys 1137502212 2414
 sys/src/cmd/unix/drawterm/posix-386 - 20000000775 sys sys 1135900540 0
 sys/src/cmd/unix/drawterm/posix-386/Makefile - 664 sys sys 1135900540 378
 sys/src/cmd/unix/drawterm/posix-386/getcallerpc.c - 664 sys sys 1135900540 90

+ 84 - 0
dist/replica/plan9.log

@@ -27046,3 +27046,87 @@
 1137468708 7 c 386/lib/ape/libregexp.a - 664 sys sys 1137468669 47670
 1137469705 0 a sys/lib/ghostscript/xlatmap - 664 sys sys 1137469677 1750
 1137469705 1 c sys/src/ape/lib/utf/utfecpy.c - 664 sys sys 1137468847 1079
+1137486714 0 c 386/lib/ape/libutf.a - 664 sys sys 1137485201 84674
+1137486714 1 c 386/lib/ape/libv.a - 664 sys sys 1137485201 19668
+1137502918 0 a sys/src/cmd/unix/drawterm/Make.irix - 664 sys sys 1137502401 493
+1137502918 1 c sys/src/cmd/unix/drawterm/kern/devroot.c - 664 sys sys 1137502216 4755
+1137502918 2 c sys/src/cmd/unix/drawterm/kern/sysfile.c - 664 sys sys 1137502217 18037
+1137502918 3 c sys/src/cmd/unix/drawterm/libc/Makefile - 664 sys sys 1137502398 1113
+1137502918 4 c sys/src/cmd/unix/drawterm/libc/charstod.c - 664 sys sys 1137502219 1997
+1137502918 5 c sys/src/cmd/unix/drawterm/libc/dofmt.c - 664 sys sys 1137502220 9839
+1137502918 6 c sys/src/cmd/unix/drawterm/libc/dorfmt.c - 664 sys sys 1137502220 1585
+1137502918 7 c sys/src/cmd/unix/drawterm/libc/fltfmt.c - 664 sys sys 1137502220 7176
+1137502918 8 c sys/src/cmd/unix/drawterm/libc/fmt.c - 664 sys sys 1137502220 4238
+1137502918 9 c sys/src/cmd/unix/drawterm/libc/fmt.h - 664 sys sys 1137502221 3423
+1137502918 10 c sys/src/cmd/unix/drawterm/libc/fmtdef.h - 664 sys sys 1137502221 3448
+1137502918 11 c sys/src/cmd/unix/drawterm/libc/fmtfd.c - 664 sys sys 1137502221 1294
+1137502918 12 c sys/src/cmd/unix/drawterm/libc/fmtlock.c - 664 sys sys 1137502221 881
+1137502918 13 c sys/src/cmd/unix/drawterm/libc/fmtprint.c - 664 sys sys 1137502222 1304
+1137502918 14 c sys/src/cmd/unix/drawterm/libc/fmtquote.c - 664 sys sys 1137502222 5557
+1137502918 15 c sys/src/cmd/unix/drawterm/libc/fmtrune.c - 664 sys sys 1137502222 1122
+1137502918 16 c sys/src/cmd/unix/drawterm/libc/fmtstr.c - 664 sys sys 1137502222 961
+1137502918 17 c sys/src/cmd/unix/drawterm/libc/fmtvprint.c - 664 sys sys 1137502222 1313
+1137502918 18 c sys/src/cmd/unix/drawterm/libc/fprint.c - 664 sys sys 1137502223 968
+1137502918 19 c sys/src/cmd/unix/drawterm/libc/nan64.c - 664 sys sys 1137502224 1054
+1137502918 20 c sys/src/cmd/unix/drawterm/libc/pow10.c - 664 sys sys 1137502224 1989
+1137502918 21 c sys/src/cmd/unix/drawterm/libc/print.c - 664 sys sys 1137502224 958
+1137502918 22 c sys/src/cmd/unix/drawterm/libc/runefmtstr.c - 664 sys sys 1137502225 958
+1137502918 23 c sys/src/cmd/unix/drawterm/libc/runeseprint.c - 664 sys sys 1137502225 1018
+1137502918 24 c sys/src/cmd/unix/drawterm/libc/runesmprint.c - 664 sys sys 1137502225 990
+1137502918 25 c sys/src/cmd/unix/drawterm/libc/runesnprint.c - 664 sys sys 1137502225 1017
+1137502918 26 c sys/src/cmd/unix/drawterm/libc/runesprint.c - 664 sys sys 1137502226 1006
+1137502918 27 c sys/src/cmd/unix/drawterm/libc/runevseprint.c - 664 sys sys 1137502226 1158
+1137502918 28 c sys/src/cmd/unix/drawterm/libc/runevsmprint.c - 664 sys sys 1137502227 2148
+1137502918 29 c sys/src/cmd/unix/drawterm/libc/runevsnprint.c - 664 sys sys 1137502227 1168
+1137502918 30 c sys/src/cmd/unix/drawterm/libc/seprint.c - 664 sys sys 1137502227 990
+1137502918 31 c sys/src/cmd/unix/drawterm/libc/smprint.c - 664 sys sys 1137502227 962
+1137502918 32 c sys/src/cmd/unix/drawterm/libc/snprint.c - 664 sys sys 1137502227 989
+1137502918 33 c sys/src/cmd/unix/drawterm/libc/sprint.c - 664 sys sys 1137502228 1235
+1137502918 34 c sys/src/cmd/unix/drawterm/libc/strtod.c - 664 sys sys 1137502228 9233
+1137502918 35 a sys/src/cmd/unix/drawterm/libc/fmtfdflush.c - 664 sys sys 1137502221 1081
+1137502918 36 a sys/src/cmd/unix/drawterm/libc/plan9.h - 664 sys sys 1137502224 719
+1137502918 37 c sys/src/cmd/unix/drawterm/libc/vfprint.c - 664 sys sys 1137502229 1069
+1137502918 38 c sys/src/cmd/unix/drawterm/libc/vseprint.c - 664 sys sys 1137502229 1132
+1137502918 39 c sys/src/cmd/unix/drawterm/libc/vsmprint.c - 664 sys sys 1137502229 2047
+1137502918 40 c sys/src/cmd/unix/drawterm/libc/vsnprint.c - 664 sys sys 1137502230 1162
+1137502918 41 c sys/src/cmd/unix/drawterm/libmemdraw/draw.c - 664 sys sys 1137502231 54659
+1137502918 42 c sys/src/cmd/unix/drawterm/main.c - 664 sys sys 1137502212 2414
+1137506520 0 c sys/src/cmd/unix/drawterm/include/lib.h - 664 sys sys 1137506302 7467
+1137506520 1 c sys/src/cmd/unix/drawterm/include/unix.h - 664 sys sys 1137506303 349
+1137506520 2 c sys/src/cmd/unix/drawterm/libc/charstod.c - 664 sys sys 1137506307 1954
+1137506520 3 c sys/src/cmd/unix/drawterm/libc/dofmt.c - 664 sys sys 1137506308 9771
+1137506520 4 c sys/src/cmd/unix/drawterm/libc/dorfmt.c - 664 sys sys 1137506308 1542
+1137506520 5 c sys/src/cmd/unix/drawterm/libc/fltfmt.c - 664 sys sys 1137506308 7053
+1137506520 6 c sys/src/cmd/unix/drawterm/libc/fmt.c - 664 sys sys 1137506308 4195
+1137506520 7 c sys/src/cmd/unix/drawterm/libc/fmtdef.h - 664 sys sys 1137506309 3466
+1137506520 8 c sys/src/cmd/unix/drawterm/libc/fmtlock.c - 664 sys sys 1137506309 136
+1137506520 9 c sys/src/cmd/unix/drawterm/libc/fmtprint.c - 664 sys sys 1137506309 1261
+1137506520 10 c sys/src/cmd/unix/drawterm/libc/fmtquote.c - 664 sys sys 1137506309 5514
+1137506520 11 c sys/src/cmd/unix/drawterm/libc/fmtrune.c - 664 sys sys 1137506309 1079
+1137506520 12 c sys/src/cmd/unix/drawterm/libc/fmtstr.c - 664 sys sys 1137506310 918
+1137506520 13 c sys/src/cmd/unix/drawterm/libc/fmtvprint.c - 664 sys sys 1137506310 1270
+1137506520 14 c sys/src/cmd/unix/drawterm/libc/fprint.c - 664 sys sys 1137506310 945
+1137506520 15 c sys/src/cmd/unix/drawterm/libc/nan64.c - 664 sys sys 1137506310 1051
+1137506520 16 c sys/src/cmd/unix/drawterm/libc/pow10.c - 664 sys sys 1137506311 1946
+1137506520 17 c sys/src/cmd/unix/drawterm/libc/print.c - 664 sys sys 1137506311 935
+1137506520 18 c sys/src/cmd/unix/drawterm/libc/runefmtstr.c - 664 sys sys 1137506312 915
+1137506520 19 c sys/src/cmd/unix/drawterm/libc/runeseprint.c - 664 sys sys 1137506312 975
+1137506520 20 c sys/src/cmd/unix/drawterm/libc/runesmprint.c - 664 sys sys 1137506312 947
+1137506520 21 c sys/src/cmd/unix/drawterm/libc/runesnprint.c - 664 sys sys 1137506312 974
+1137506520 22 c sys/src/cmd/unix/drawterm/libc/runesprint.c - 664 sys sys 1137506312 963
+1137506520 23 c sys/src/cmd/unix/drawterm/libc/runevseprint.c - 664 sys sys 1137506313 1115
+1137506520 24 c sys/src/cmd/unix/drawterm/libc/runevsmprint.c - 664 sys sys 1137506313 1854
+1137506520 25 c sys/src/cmd/unix/drawterm/libc/runevsnprint.c - 664 sys sys 1137506314 1125
+1137506520 26 c sys/src/cmd/unix/drawterm/libc/seprint.c - 664 sys sys 1137506314 967
+1137506520 27 c sys/src/cmd/unix/drawterm/libc/smprint.c - 664 sys sys 1137506314 939
+1137506520 28 c sys/src/cmd/unix/drawterm/libc/snprint.c - 664 sys sys 1137506314 966
+1137506520 29 c sys/src/cmd/unix/drawterm/libc/sprint.c - 664 sys sys 1137506315 1195
+1137506520 30 c sys/src/cmd/unix/drawterm/libc/strtod.c - 664 sys sys 1137506315 9114
+1137506520 31 c sys/src/cmd/unix/drawterm/libc/vfprint.c - 664 sys sys 1137506316 1046
+1137506520 32 c sys/src/cmd/unix/drawterm/libc/vseprint.c - 664 sys sys 1137506316 1109
+1137506520 33 c sys/src/cmd/unix/drawterm/libc/vsmprint.c - 664 sys sys 1137506316 1754
+1137506520 34 c sys/src/cmd/unix/drawterm/libc/vsnprint.c - 664 sys sys 1137506317 1119
+1137506520 35 d sys/src/cmd/unix/drawterm/libc/plan9.h - 664 sys sys 1137502224 0
+1137506520 36 d sys/src/cmd/unix/drawterm/libc/fmt.h - 664 sys sys 1137502221 0
+1137511922 0 a sys/lib/ghostscript/cidfmap - 664 sys sys 1137510335 996
+1137511922 1 m sys/src/cmd/gs/src/gconfigd.h - 664 sys sys 1137462407 275

+ 28 - 0
sys/lib/ghostscript/cidfmap

@@ -0,0 +1,28 @@
+%!
+% $Id: cidfmap,v 1.7 2003/02/07 00:31:11 igor Exp $
+% This is a sample map file for CIDFont category.
+
+%
+% The map is a set of records, which must use one of the two formats :
+%
+% 1. A substutution of a CIF font with another CID font :
+%
+%    /substituted /original ;
+%
+%    Where 'substituted' is a name being used in a document,
+%    'original' is a name of an available resource.
+%
+% 2. A substutution of a CIF font with a True Type font :
+%
+%    /substituted << /FileType /TrueType /Path (path) /SunfontID 1 /CSI [(ordering) supplement] >> ;
+%
+%    Where 'substituted' is a name being used in a document,
+%    'path' is a path to a True Type font file,
+%    'ordering' is a value of Ordering required for CIDSystemInfo dictionary,
+%    'supplement' is a value of Supplement required for CIDSystemInfo dictionary.
+%
+% Examples :
+%    
+%   /ShinGo-Bold   /HeiseiKakuGo-W5 ;
+%   /Ryumin-Medium << /FileType /TrueType /Path (H:/AuxFiles/Fonts/BATANG.TTC) /SubfontID 3 /CSI [(Japan1) 2] >> ;
+%

+ 24 - 0
sys/src/cmd/unix/drawterm/Make.irix

@@ -0,0 +1,24 @@
+# Unix
+PTHREAD=	# for Mac
+#PTHREAD=-pthread
+AR=ar
+AS=as
+ASFLAGS=-c -mips3
+RANLIB=true
+X11=/usr/X11R6
+#CC=gcc
+#CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
+CC=cc
+CFLAGS=-g -O2 -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include  -DIRIX
+O=o
+OS=posix
+GUI=x11
+LDADD=-L$(X11)/lib -lX11 -g -lpthread
+LDFLAGS=$(PTHREAD)
+TARG=drawterm
+MAKE=gmake
+
+all: default
+
+libmachdep.a:
+	(cd posix-mips && $(MAKE))

+ 7 - 5
sys/src/cmd/unix/drawterm/include/lib.h

@@ -3,8 +3,7 @@
 #define listen  pm_listen
 #define sleep	ksleep
 #define wakeup	kwakeup
-#define strtod		libstrtod
-#define pow10	libpow10
+#define strtod		fmtstrtod
 
 /* conflicts on some os's */
 #define encrypt	libencrypt
@@ -200,7 +199,8 @@ enum{
 	FmtComma	= FmtVLong << 1,
 	FmtByte	= FmtComma << 1,
 
-	FmtFlag		= FmtByte << 1
+	FmtFlag		= FmtByte << 1,
+	FmtLDouble	= FmtFlag << 1
 };
 
 extern	int	print(char*, ...);
@@ -253,8 +253,10 @@ void		hnputs(void *p, unsigned short v);
 extern	int	dofmt(Fmt*, char*);
 extern	double	__NaN(void);
 extern	int	__isNaN(double);
-extern	double	strtod(char*, char**);
+extern	double	strtod(const char*, char**);
 extern	int	utfnlen(char*, long);
 extern	double	__Inf(int);
 extern	int	__isInf(double, int);
-extern	double	pow10(int);
+
+extern int (*fmtdoquote)(int);
+

+ 4 - 1
sys/src/cmd/unix/drawterm/include/unix.h

@@ -8,7 +8,10 @@
 #include <assert.h>
 #include <unistd.h>
 #include <stdarg.h>
-
+#include <inttypes.h>
+#include <ctype.h>
+#include <errno.h>
 
 typedef long long		p9_vlong;
 typedef	unsigned long long p9_uvlong;
+typedef uintptr_t uintptr;

+ 2 - 1
sys/src/cmd/unix/drawterm/kern/devroot.c

@@ -54,6 +54,7 @@ static Dirlist bootlist =
 	Nbootfiles
 };
 
+static uchar *mntdata[Nmntfiles];
 static Dirtab mntdir[Nmntfiles] = {
 	"mnt",	{Qmnt, 0, QTDIR},	0,		DMDIR|0555,
 	"factotum",	{Qfactotum, 0, QTDIR},	0,	DMDIR|0555,
@@ -62,7 +63,7 @@ static Dirlist mntlist =
 {
 	Qmnt,
 	mntdir,
-	nil,
+	mntdata,
 	2,
 	Nmntfiles
 };

+ 1 - 1
sys/src/cmd/unix/drawterm/kern/sysfile.c

@@ -1158,7 +1158,7 @@ werrstr(char *f, ...)
 }
 
 int
-errfmt(Fmt *fmt)
+__errfmt(Fmt *fmt)
 {
 	if(up->nerrlab)
 		return fmtstrcpy(fmt, up->errstr);

+ 1 - 0
sys/src/cmd/unix/drawterm/libc/Makefile

@@ -22,6 +22,7 @@ OFILES=\
 	fltfmt.$O\
 	fmt.$O\
 	fmtfd.$O\
+	fmtfdflush.$O\
 	fmtlock.$O\
 	fmtprint.$O\
 	fmtquote.$O\

+ 56 - 54
sys/src/cmd/unix/drawterm/libc/charstod.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 /*
  * Reads a floating-point number by interpreting successive characters
@@ -8,74 +22,62 @@
  * necessary to back up the input stream up one byte after calling charstod.
  */
 
-#define ADVANCE *s++ = c; if(s>=e) return __NaN(); c = (*f)(vp)
-
 double
-charstod(int(*f)(void*), void *vp)
+fmtcharstod(int(*f)(void*), void *vp)
 {
-	char str[400], *s, *e, *start;
-	int c;
+	double num, dem;
+	int neg, eneg, dig, exp, c;
+
+	num = 0;
+	neg = 0;
+	dig = 0;
+	exp = 0;
+	eneg = 0;
 
-	s = str;
-	e = str + sizeof str - 1;
 	c = (*f)(vp);
 	while(c == ' ' || c == '\t')
 		c = (*f)(vp);
 	if(c == '-' || c == '+'){
-		ADVANCE;
+		if(c == '-')
+			neg = 1;
+		c = (*f)(vp);
 	}
-	start = s;
 	while(c >= '0' && c <= '9'){
-		ADVANCE;
+		num = num*10 + c-'0';
+		c = (*f)(vp);
 	}
-	if(c == '.'){
-		ADVANCE;
-		while(c >= '0' && c <= '9'){
-			ADVANCE;
-		}
+	if(c == '.')
+		c = (*f)(vp);
+	while(c >= '0' && c <= '9'){
+		num = num*10 + c-'0';
+		dig++;
+		c = (*f)(vp);
 	}
-	if(s > start && (c == 'e' || c == 'E')){
-		ADVANCE;
+	if(c == 'e' || c == 'E'){
+		c = (*f)(vp);
 		if(c == '-' || c == '+'){
-			ADVANCE;
+			if(c == '-'){
+				dig = -dig;
+				eneg = 1;
+			}
+			c = (*f)(vp);
 		}
 		while(c >= '0' && c <= '9'){
-			ADVANCE;
+			exp = exp*10 + c-'0';
+			c = (*f)(vp);
 		}
-	}else if(s == start && (c == 'i' || c == 'I')){
-		ADVANCE;
-		if(c != 'n' && c != 'N')
-			return __NaN();
-		ADVANCE;
-		if(c != 'f' && c != 'F')
-			return __NaN();
-		ADVANCE;
-		if(c != 'i' && c != 'I')
-			return __NaN();
-		ADVANCE;
-		if(c != 'n' && c != 'N')
-			return __NaN();
-		ADVANCE;
-		if(c != 'i' && c != 'I')
-			return __NaN();
-		ADVANCE;
-		if(c != 't' && c != 'T')
-			return __NaN();
-		ADVANCE;
-		if(c != 'y' && c != 'Y')
-			return __NaN();
-		ADVANCE;  /* so caller can back up uniformly */
-		USED(c);
-	}else if(s == str && (c == 'n' || c == 'N')){
-		ADVANCE;
-		if(c != 'a' && c != 'A')
-			return __NaN();
-		ADVANCE;
-		if(c != 'n' && c != 'N')
-			return __NaN();
-		ADVANCE;  /* so caller can back up uniformly */
-		USED(c);
 	}
-	*s = 0;
-	return strtod(str, &s);
+	exp -= dig;
+	if(exp < 0){
+		exp = -exp;
+		eneg = !eneg;
+	}
+	dem = __fmtpow10(exp);
+	if(eneg)
+		num /= dem;
+	else
+		num *= dem;
+	if(neg)
+		return -num;
+	return num;
 }

+ 91 - 63
sys/src/cmd/unix/drawterm/libc/dofmt.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -14,8 +27,8 @@ dofmt(Fmt *f, char *fmt)
 	nfmt = f->nfmt;
 	for(;;){
 		if(f->runes){
-			rt = f->to;
-			rs = f->stop;
+			rt = (Rune*)f->to;
+			rs = (Rune*)f->stop;
 			while((r = *(uchar*)fmt) && r != '%'){
 				if(r < Runeself)
 					fmt++;
@@ -32,8 +45,8 @@ dofmt(Fmt *f, char *fmt)
 				return f->nfmt - nfmt;
 			f->stop = rs;
 		}else{
-			t = f->to;
-			s = f->stop;
+			t = (char*)f->to;
+			s = (char*)f->stop;
 			while((r = *(uchar*)fmt) && r != '%'){
 				if(r < Runeself){
 					FMTCHAR(f, t, s, r);
@@ -41,9 +54,9 @@ dofmt(Fmt *f, char *fmt)
 				}else{
 					n = chartorune(&rune, fmt);
 					if(t + n > s){
-						t = _fmtflush(f, t, n);
+						t = (char*)__fmtflush(f, t, n);
 						if(t != nil)
-							s = f->stop;
+							s = (char*)f->stop;
 						else
 							return -1;
 					}
@@ -59,15 +72,14 @@ dofmt(Fmt *f, char *fmt)
 			f->stop = s;
 		}
 
-		fmt = _fmtdispatch(f, fmt, 0);
+		fmt = (char*)__fmtdispatch(f, fmt, 0);
 		if(fmt == nil)
 			return -1;
 	}
-	return 0;	/* not reached */
 }
 
 void *
-_fmtflush(Fmt *f, void *t, int len)
+__fmtflush(Fmt *f, void *t, int len)
 {
 	if(f->runes)
 		f->nfmt += (Rune*)t - (Rune*)f->to;
@@ -86,13 +98,13 @@ _fmtflush(Fmt *f, void *t, int len)
  * left/right justified in a field of at least f->width charactes
  */
 int
-_fmtpad(Fmt *f, int n)
+__fmtpad(Fmt *f, int n)
 {
 	char *t, *s;
 	int i;
 
-	t = f->to;
-	s = f->stop;
+	t = (char*)f->to;
+	s = (char*)f->stop;
 	for(i = 0; i < n; i++)
 		FMTCHAR(f, t, s, ' ');
 	f->nfmt += t - (char *)f->to;
@@ -101,13 +113,13 @@ _fmtpad(Fmt *f, int n)
 }
 
 int
-_rfmtpad(Fmt *f, int n)
+__rfmtpad(Fmt *f, int n)
 {
 	Rune *t, *s;
 	int i;
 
-	t = f->to;
-	s = f->stop;
+	t = (Rune*)f->to;
+	s = (Rune*)f->stop;
 	for(i = 0; i < n; i++)
 		FMTRCHAR(f, t, s, ' ');
 	f->nfmt += t - (Rune *)f->to;
@@ -116,24 +128,24 @@ _rfmtpad(Fmt *f, int n)
 }
 
 int
-_fmtcpy(Fmt *f, void *vm, int n, int sz)
+__fmtcpy(Fmt *f, const void *vm, int n, int sz)
 {
 	Rune *rt, *rs, r;
 	char *t, *s, *m, *me;
 	ulong fl;
 	int nc, w;
 
-	m = vm;
+	m = (char*)vm;
 	me = m + sz;
 	w = f->width;
 	fl = f->flags;
 	if((fl & FmtPrec) && n > f->prec)
 		n = f->prec;
 	if(f->runes){
-		if(!(fl & FmtLeft) && _rfmtpad(f, w - n) < 0)
+		if(!(fl & FmtLeft) && __rfmtpad(f, w - n) < 0)
 			return -1;
-		rt = f->to;
-		rs = f->stop;
+		rt = (Rune*)f->to;
+		rs = (Rune*)f->stop;
 		for(nc = n; nc > 0; nc--){
 			r = *(uchar*)m;
 			if(r < Runeself)
@@ -146,15 +158,13 @@ _fmtcpy(Fmt *f, void *vm, int n, int sz)
 		}
 		f->nfmt += rt - (Rune *)f->to;
 		f->to = rt;
-		if(m < me)
-			return -1;
-		if(fl & FmtLeft && _rfmtpad(f, w - n) < 0)
+		if(fl & FmtLeft && __rfmtpad(f, w - n) < 0)
 			return -1;
 	}else{
-		if(!(fl & FmtLeft) && _fmtpad(f, w - n) < 0)
+		if(!(fl & FmtLeft) && __fmtpad(f, w - n) < 0)
 			return -1;
-		t = f->to;
-		s = f->stop;
+		t = (char*)f->to;
+		s = (char*)f->stop;
 		for(nc = n; nc > 0; nc--){
 			r = *(uchar*)m;
 			if(r < Runeself)
@@ -167,48 +177,48 @@ _fmtcpy(Fmt *f, void *vm, int n, int sz)
 		}
 		f->nfmt += t - (char *)f->to;
 		f->to = t;
-		if(fl & FmtLeft && _fmtpad(f, w - n) < 0)
+		if(fl & FmtLeft && __fmtpad(f, w - n) < 0)
 			return -1;
 	}
 	return 0;
 }
 
 int
-_fmtrcpy(Fmt *f, void *vm, int n)
+__fmtrcpy(Fmt *f, const void *vm, int n)
 {
 	Rune r, *m, *me, *rt, *rs;
 	char *t, *s;
 	ulong fl;
 	int w;
 
-	m = vm;
+	m = (Rune*)vm;
 	w = f->width;
 	fl = f->flags;
 	if((fl & FmtPrec) && n > f->prec)
 		n = f->prec;
 	if(f->runes){
-		if(!(fl & FmtLeft) && _rfmtpad(f, w - n) < 0)
+		if(!(fl & FmtLeft) && __rfmtpad(f, w - n) < 0)
 			return -1;
-		rt = f->to;
-		rs = f->stop;
+		rt = (Rune*)f->to;
+		rs = (Rune*)f->stop;
 		for(me = m + n; m < me; m++)
 			FMTRCHAR(f, rt, rs, *m);
 		f->nfmt += rt - (Rune *)f->to;
 		f->to = rt;
-		if(fl & FmtLeft && _rfmtpad(f, w - n) < 0)
+		if(fl & FmtLeft && __rfmtpad(f, w - n) < 0)
 			return -1;
 	}else{
-		if(!(fl & FmtLeft) && _fmtpad(f, w - n) < 0)
+		if(!(fl & FmtLeft) && __fmtpad(f, w - n) < 0)
 			return -1;
-		t = f->to;
-		s = f->stop;
+		t = (char*)f->to;
+		s = (char*)f->stop;
 		for(me = m + n; m < me; m++){
 			r = *m;
 			FMTRUNE(f, t, s, r);
 		}
 		f->nfmt += t - (char *)f->to;
 		f->to = t;
-		if(fl & FmtLeft && _fmtpad(f, w - n) < 0)
+		if(fl & FmtLeft && __fmtpad(f, w - n) < 0)
 			return -1;
 	}
 	return 0;
@@ -216,47 +226,47 @@ _fmtrcpy(Fmt *f, void *vm, int n)
 
 /* fmt out one character */
 int
-_charfmt(Fmt *f)
+__charfmt(Fmt *f)
 {
 	char x[1];
 
 	x[0] = va_arg(f->args, int);
 	f->prec = 1;
-	return _fmtcpy(f, x, 1, 1);
+	return __fmtcpy(f, (const char*)x, 1, 1);
 }
 
 /* fmt out one rune */
 int
-_runefmt(Fmt *f)
+__runefmt(Fmt *f)
 {
 	Rune x[1];
 
 	x[0] = va_arg(f->args, int);
-	return _fmtrcpy(f, x, 1);
+	return __fmtrcpy(f, (const void*)x, 1);
 }
 
 /* public helper routine: fmt out a null terminated string already in hand */
 int
 fmtstrcpy(Fmt *f, char *s)
 {
-	int p, i;
+	int i, j;
+	Rune r;
+
 	if(!s)
-		return _fmtcpy(f, "<nil>", 5, 5);
+		return __fmtcpy(f, "<nil>", 5, 5);
 	/* if precision is specified, make sure we don't wander off the end */
 	if(f->flags & FmtPrec){
-		p = f->prec;
-		for(i = 0; i < p; i++)
-			if(s[i] == 0)
-				break;
-		return _fmtcpy(f, s, utfnlen(s, i), i);	/* BUG?: won't print a partial rune at end */
+		i = 0;
+		for(j=0; j<f->prec && s[i]; j++)
+			i += chartorune(&r, s+i);
+		return __fmtcpy(f, s, j, i);
 	}
-
-	return _fmtcpy(f, s, utflen(s), strlen(s));
+	return __fmtcpy(f, s, utflen(s), strlen(s));
 }
 
 /* fmt out a null terminated utf string */
 int
-_strfmt(Fmt *f)
+__strfmt(Fmt *f)
 {
 	char *s;
 
@@ -272,7 +282,7 @@ fmtrunestrcpy(Fmt *f, Rune *s)
 	int n, p;
 
 	if(!s)
-		return _fmtcpy(f, "<nil>", 5, 5);
+		return __fmtcpy(f, "<nil>", 5, 5);
 	/* if precision is specified, make sure we don't wander off the end */
 	if(f->flags & FmtPrec){
 		p = f->prec;
@@ -284,12 +294,12 @@ fmtrunestrcpy(Fmt *f, Rune *s)
 			;
 		n = e - s;
 	}
-	return _fmtrcpy(f, s, n);
+	return __fmtrcpy(f, s, n);
 }
 
 /* fmt out a null terminated rune string */
 int
-_runesfmt(Fmt *f)
+__runesfmt(Fmt *f)
 {
 	Rune *s;
 
@@ -299,18 +309,18 @@ _runesfmt(Fmt *f)
 
 /* fmt a % */
 int
-_percentfmt(Fmt *f)
+__percentfmt(Fmt *f)
 {
 	Rune x[1];
 
 	x[0] = f->r;
 	f->prec = 1;
-	return _fmtrcpy(f, x, 1);
+	return __fmtrcpy(f, (const void*)x, 1);
 }
 
 /* fmt an integer */
 int
-_ifmt(Fmt *f)
+__ifmt(Fmt *f)
 {
 	char buf[70], *p, *conv;
 	uvlong vu;
@@ -322,6 +332,19 @@ _ifmt(Fmt *f)
 	isv = 0;
 	vu = 0;
 	u = 0;
+	/*
+	 * Unsigned verbs for ANSI C
+	 */
+	switch(f->r){
+	case 'x':
+	case 'X':
+	case 'o':
+	case 'u':
+	case 'p':
+		fl |= FmtUnsigned;
+		fl &= ~(FmtSign|FmtSpace);
+		break;
+	}
 	if(f->r == 'p'){
 		u = (ulong)va_arg(f->args, void*);
 		f->r = 'x';
@@ -356,6 +379,8 @@ _ifmt(Fmt *f)
 	conv = "0123456789abcdef";
 	switch(f->r){
 	case 'd':
+	case 'i':
+	case 'u':
 		base = 10;
 		break;
 	case 'x':
@@ -426,7 +451,7 @@ _ifmt(Fmt *f)
 				n++;
 		}
 	}
-	if((fl & FmtZero) && !(fl & FmtLeft)){
+	if((fl & FmtZero) && !(fl & (FmtLeft|FmtPrec))){
 		for(w = f->width; n < w && p > buf+3; n++)
 			*p-- = '0';
 		f->width = 0;
@@ -444,11 +469,11 @@ _ifmt(Fmt *f)
 	else if(fl & FmtSpace)
 		*p-- = ' ';
 	f->flags &= ~FmtPrec;
-	return _fmtcpy(f, p + 1, n, n);
+	return __fmtcpy(f, p + 1, n, n);
 }
 
 int
-_countfmt(Fmt *f)
+__countfmt(Fmt *f)
 {
 	void *p;
 	ulong fl;
@@ -470,7 +495,7 @@ _countfmt(Fmt *f)
 }
 
 int
-_flagfmt(Fmt *f)
+__flagfmt(Fmt *f)
 {
 	switch(f->r){
 	case ',':
@@ -496,6 +521,9 @@ _flagfmt(Fmt *f)
 			f->flags |= FmtByte;
 		f->flags |= FmtShort;
 		break;
+	case 'L':
+		f->flags |= FmtLDouble;
+		break;
 	case 'l':
 		if(f->flags & FmtLong)
 			f->flags |= FmtVLong;
@@ -507,7 +535,7 @@ _flagfmt(Fmt *f)
 
 /* default error format */
 int
-_badfmt(Fmt *f)
+__badfmt(Fmt *f)
 {
 	char x[3];
 
@@ -515,6 +543,6 @@ _badfmt(Fmt *f)
 	x[1] = f->r;
 	x[2] = '%';
 	f->prec = 3;
-	_fmtcpy(f, x, 3, 3);
+	__fmtcpy(f, (const void*)x, 3, 3);
 	return 0;
 }

+ 15 - 2
sys/src/cmd/unix/drawterm/libc/dorfmt.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -5,7 +18,7 @@
 /* format the output into f->to and return the number of characters fmted  */
 
 int
-dorfmt(Fmt *f, Rune *fmt)
+dorfmt(Fmt *f, const Rune *fmt)
 {
 	Rune *rt, *rs;
 	int r;
@@ -38,7 +51,7 @@ dorfmt(Fmt *f, Rune *fmt)
 			f->stop = s;
 		}
 
-		fmt = _fmtdispatch(f, fmt, 1);
+		fmt = __fmtdispatch(f, (Rune*)fmt, 1);
 		if(fmt == nil)
 			return -1;
 	}

+ 85 - 9
sys/src/cmd/unix/drawterm/libc/fltfmt.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include <float.h>
 #include <ctype.h>
 #include "fmtdef.h"
 
@@ -7,9 +21,71 @@ enum
 {
 	FDIGIT	= 30,
 	FDEFLT	= 6,
-	NSIGNIF	= 17,
+	NSIGNIF	= 17
 };
 
+/*
+ * first few powers of 10, enough for about 1/2 of the
+ * total space for doubles.
+ */
+static double pows10[] =
+{
+	  1e0,   1e1,   1e2,   1e3,   1e4,   1e5,   1e6,   1e7,   1e8,   1e9,  
+	 1e10,  1e11,  1e12,  1e13,  1e14,  1e15,  1e16,  1e17,  1e18,  1e19,  
+	 1e20,  1e21,  1e22,  1e23,  1e24,  1e25,  1e26,  1e27,  1e28,  1e29,  
+	 1e30,  1e31,  1e32,  1e33,  1e34,  1e35,  1e36,  1e37,  1e38,  1e39,  
+	 1e40,  1e41,  1e42,  1e43,  1e44,  1e45,  1e46,  1e47,  1e48,  1e49,  
+	 1e50,  1e51,  1e52,  1e53,  1e54,  1e55,  1e56,  1e57,  1e58,  1e59,  
+	 1e60,  1e61,  1e62,  1e63,  1e64,  1e65,  1e66,  1e67,  1e68,  1e69,  
+	 1e70,  1e71,  1e72,  1e73,  1e74,  1e75,  1e76,  1e77,  1e78,  1e79,  
+	 1e80,  1e81,  1e82,  1e83,  1e84,  1e85,  1e86,  1e87,  1e88,  1e89,  
+	 1e90,  1e91,  1e92,  1e93,  1e94,  1e95,  1e96,  1e97,  1e98,  1e99,  
+	1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109, 
+	1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119, 
+	1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129, 
+	1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139, 
+	1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149, 
+	1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, 
+};
+
+#undef pow10
+#define  pow10(x)  fmtpow10(x)
+
+static double
+pow10(int n)
+{
+	double d;
+	int neg;
+
+	neg = 0;
+	if(n < 0){
+		if(n < DBL_MIN_10_EXP){
+			return 0.;
+		}
+		neg = 1;
+		n = -n;
+	}else if(n > DBL_MAX_10_EXP){
+		return HUGE_VAL;
+	}
+	if(n < (int)(sizeof(pows10)/sizeof(pows10[0])))
+		d = pows10[n];
+	else{
+		d = pows10[sizeof(pows10)/sizeof(pows10[0]) - 1];
+		for(;;){
+			n -= sizeof(pows10)/sizeof(pows10[0]) - 1;
+			if(n < (int)(sizeof(pows10)/sizeof(pows10[0]))){
+				d *= pows10[n];
+				break;
+			}
+			d *= pows10[sizeof(pows10)/sizeof(pows10[0]) - 1];
+		}
+	}
+	if(neg){
+		return 1./d;
+	}
+	return d;
+}
+
 static int
 xadd(char *a, int n, int v)
 {
@@ -27,7 +103,7 @@ xadd(char *a, int n, int v)
 		*b = '0';
 		v = 1;
 	}
-	*a = '1';	// overflow adding
+	*a = '1';	/* overflow adding */
 	return 1;
 }
 
@@ -46,7 +122,7 @@ xsub(char *a, int n, int v)
 		*b = '9';
 		v = 1;
 	}
-	*a = '9';	// underflow subtracting
+	*a = '9';	/* underflow subtracting */
 	return 1;
 }
 
@@ -291,22 +367,22 @@ found:
 	s2[d] = 0;
 }
 
-int
-_floatfmt(Fmt *fmt, double f)
+static int
+floatfmt(Fmt *fmt, double f)
 {
-	char s[FDIGIT+10];
+	char s[341];		/* precision+exponent+sign+'.'+null */
 
 	xdtoa(fmt, s, f);
 	fmt->flags &= FmtWidth|FmtLeft;
-	_fmtcpy(fmt, s, strlen(s), strlen(s));
+	__fmtcpy(fmt, s, strlen(s), strlen(s));
 	return 0;
 }
 
 int
-_efgfmt(Fmt *f)
+__efgfmt(Fmt *f)
 {
 	double d;
 
 	d = va_arg(f->args, double);
-	return _floatfmt(f, d);
+	return floatfmt(f, d);
 }

+ 78 - 42
sys/src/cmd/unix/drawterm/libc/fmt.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -16,55 +29,69 @@ struct Convfmt
 
 struct
 {
-	/* lock by calling _fmtlock, _fmtunlock */
+	/* lock by calling __fmtlock, __fmtunlock */
 	int	nfmt;
 	Convfmt	fmt[Maxfmt];
 } fmtalloc;
 
 static Convfmt knownfmt[] = {
-	' ',	_flagfmt,
-	'#',	_flagfmt,
-	'%',	_percentfmt,
-	'+',	_flagfmt,
-	',',	_flagfmt,
-	'-',	_flagfmt,
-	'C',	_runefmt,
-	'E',	_efgfmt,
-	'G',	_efgfmt,
-	'S',	_runesfmt,
-	'X',	_ifmt,
-	'b',	_ifmt,
-	'c',	_charfmt,
-	'd',	_ifmt,
-	'e',	_efgfmt,
-	'f',	_efgfmt,
-	'g',	_efgfmt,
-	'h',	_flagfmt,
-	'l',	_flagfmt,
-	'n',	_countfmt,
-	'o',	_ifmt,
-	'p',	_ifmt,
-/*	'r',	errfmt, */
-	's',	_strfmt,
-	'u',	_flagfmt,
-	'x',	_ifmt,
+	' ',	__flagfmt,
+	'#',	__flagfmt,
+	'%',	__percentfmt,
+	'+',	__flagfmt,
+	',',	__flagfmt,
+	'-',	__flagfmt,
+	'C',	__runefmt,	/* Plan 9 addition */
+	'E',	__efgfmt,
+#ifndef PLAN9PORT
+	'F',	__efgfmt,	/* ANSI only */
+#endif
+	'G',	__efgfmt,
+#ifndef PLAN9PORT
+	'L',	__flagfmt,	/* ANSI only */
+#endif
+	'S',	__runesfmt,	/* Plan 9 addition */
+	'X',	__ifmt,
+	'b',	__ifmt,		/* Plan 9 addition */
+	'c',	__charfmt,
+	'd',	__ifmt,
+	'e',	__efgfmt,
+	'f',	__efgfmt,
+	'g',	__efgfmt,
+	'h',	__flagfmt,
+#ifndef PLAN9PORT
+	'i',	__ifmt,		/* ANSI only */
+#endif
+	'l',	__flagfmt,
+	'n',	__countfmt,
+	'o',	__ifmt,
+	'p',	__ifmt,
+	'r',	__errfmt,
+	's',	__strfmt,
+#ifdef PLAN9PORT
+	'u',	__flagfmt,
+#else
+	'u',	__ifmt,
+#endif
+	'x',	__ifmt,
 	0,	nil,
 };
 
-int	(*doquote)(int);
+
+int	(*fmtdoquote)(int);
 
 /*
- * _fmtlock() must be set
+ * __fmtlock() must be set
  */
 static int
-_fmtinstall(int c, Fmts f)
+__fmtinstall(int c, Fmts f)
 {
 	Convfmt *p, *ep;
 
 	if(c<=0 || c>=65536)
 		return -1;
 	if(!f)
-		f = _badfmt;
+		f = __badfmt;
 
 	ep = &fmtalloc.fmt[fmtalloc.nfmt];
 	for(p=fmtalloc.fmt; p<ep; p++)
@@ -84,13 +111,13 @@ _fmtinstall(int c, Fmts f)
 }
 
 int
-fmtinstall(int c, Fmts f)
+fmtinstall(int c, int (*f)(Fmt*))
 {
 	int ret;
 
-	_fmtlock();
-	ret = _fmtinstall(c, f);
-	_fmtunlock();
+	__fmtlock();
+	ret = __fmtinstall(c, f);
+	__fmtunlock();
 	return ret;
 }
 
@@ -108,20 +135,20 @@ fmtfmt(int c)
 		}
 
 	/* is this a predefined format char? */
-	_fmtlock();
+	__fmtlock();
 	for(p=knownfmt; p->c; p++)
 		if(p->c == c){
-			_fmtinstall(p->c, p->fmt);
-			_fmtunlock();
+			__fmtinstall(p->c, p->fmt);
+			__fmtunlock();
 			return p->fmt;
 		}
-	_fmtunlock();
+	__fmtunlock();
 
-	return _badfmt;
+	return __badfmt;
 }
 
 void*
-_fmtdispatch(Fmt *f, void *fmt, int isrunes)
+__fmtdispatch(Fmt *f, void *fmt, int isrunes)
 {
 	Rune rune, r;
 	int i, n;
@@ -134,7 +161,7 @@ _fmtdispatch(Fmt *f, void *fmt, int isrunes)
 			r = *(Rune*)fmt;
 			fmt = (Rune*)fmt + 1;
 		}else{
-			fmt = (char*)fmt + chartorune(&rune, fmt);
+			fmt = (char*)fmt + chartorune(&rune, (char*)fmt);
 			r = rune;
 		}
 		f->r = r;
@@ -179,6 +206,15 @@ _fmtdispatch(Fmt *f, void *fmt, int isrunes)
 		case '*':
 			i = va_arg(f->args, int);
 			if(i < 0){
+				/*
+				 * negative precision =>
+				 * ignore the precision.
+				 */
+				if(f->flags & FmtPrec){
+					f->flags &= ~FmtPrec;
+					f->prec = 0;
+					continue;
+				}
 				i = -i;
 				f->flags |= FmtLeft;
 			}

+ 0 - 99
sys/src/cmd/unix/drawterm/libc/fmt.h

@@ -1,99 +0,0 @@
-
-/*
- * The authors of this software are Rob Pike and Ken Thompson.
- *              Copyright (c) 2002 by Lucent Technologies.
- * Permission to use, copy, modify, and distribute this software for any
- * purpose without fee is hereby granted, provided that this entire notice
- * is included in all copies of any software which is or includes a copy
- * or modification of this software and in all copies of the supporting
- * documentation for such software.
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
- * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
- * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
- */
-
-#ifndef _FMTH_
-#define _FMTH_ 1
-
-#include <stdarg.h>
-
-#ifndef _UTFH_
-#include <utf.h>
-#endif
-
-typedef struct Fmt	Fmt;
-struct Fmt{
-	unsigned char	runes;		/* output buffer is runes or chars? */
-	void	*start;			/* of buffer */
-	void	*to;			/* current place in the buffer */
-	void	*stop;			/* end of the buffer; overwritten if flush fails */
-	int	(*flush)(Fmt *);	/* called when to == stop */
-	void	*farg;			/* to make flush a closure */
-	int	nfmt;			/* num chars formatted so far */
-	va_list	args;			/* args passed to dofmt */
-	int	r;			/* % format Rune */
-	int	width;
-	int	prec;
-	unsigned long	flags;
-};
-
-enum{
-	FmtWidth	= 1,
-	FmtLeft		= FmtWidth << 1,
-	FmtPrec		= FmtLeft << 1,
-	FmtSharp	= FmtPrec << 1,
-	FmtSpace	= FmtSharp << 1,
-	FmtSign		= FmtSpace << 1,
-	FmtZero		= FmtSign << 1,
-	FmtUnsigned	= FmtZero << 1,
-	FmtShort	= FmtUnsigned << 1,
-	FmtLong		= FmtShort << 1,
-	FmtVLong	= FmtLong << 1,
-	FmtComma	= FmtVLong << 1,
-	FmtByte		= FmtComma << 1,
-	FmtLDouble	= FmtByte << 1,
-
-	FmtFlag		= FmtLDouble << 1
-};
-
-extern	int	print(char*, ...);
-extern	char*	seprint(char*, char*, char*, ...);
-extern	char*	vseprint(char*, char*, char*, va_list);
-extern	int	snprint(char*, int, char*, ...);
-extern	int	vsnprint(char*, int, char*, va_list);
-extern	char*	smprint(char*, ...);
-extern	char*	vsmprint(char*, va_list);
-extern	int	sprint(char*, char*, ...);
-extern	int	fprint(int, char*, ...);
-extern	int	vfprint(int, char*, va_list);
-
-extern	int	runesprint(Rune*, char*, ...);
-extern	int	runesnprint(Rune*, int, char*, ...);
-extern	int	runevsnprint(Rune*, int, char*, va_list);
-extern	Rune*	runeseprint(Rune*, Rune*, char*, ...);
-extern	Rune*	runevseprint(Rune*, Rune*, char*, va_list);
-extern	Rune*	runesmprint(char*, ...);
-extern	Rune*	runevsmprint(char*, va_list);
-
-extern	int	fmtfdinit(Fmt*, int, char*, int);
-extern	int	fmtfdflush(Fmt*);
-extern	int	fmtstrinit(Fmt*);
-extern	char*	fmtstrflush(Fmt*);
-
-extern	int	quotestrfmt(Fmt *f);
-extern	void	quotefmtinstall(void);
-extern	int	(*fmtdoquote)(int);
-
-
-extern	int	fmtinstall(int, int (*)(Fmt*));
-extern	int	dofmt(Fmt*, char*);
-extern	int	fmtprint(Fmt*, char*, ...);
-extern	int	fmtvprint(Fmt*, char*, va_list);
-extern	int	fmtrune(Fmt*, int);
-extern	int	fmtstrcpy(Fmt*, char*);
-
-extern	double	fmtstrtod(const char *, char **);
-extern	double	fmtcharstod(int(*)(void*), void*);
-
-#endif

+ 57 - 25
sys/src/cmd/unix/drawterm/libc/fmtdef.h

@@ -1,3 +1,17 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+
 /*
  * dofmt -- format to a buffer
  * the number of characters formatted is returned,
@@ -18,33 +32,41 @@ struct Quoteinfo
 	int	nbytesout;	/* number of bytes that will be generated */
 };
 
-void	*_fmtflush(Fmt*, void*, int);
-void	*_fmtdispatch(Fmt*, void*, int);
-int	_floatfmt(Fmt*, double);
-int	_fmtpad(Fmt*, int);
-int	_rfmtpad(Fmt*, int);
-int	_fmtFdFlush(Fmt*);
-
-int	_efgfmt(Fmt*);
-int	_charfmt(Fmt*);
-int	_countfmt(Fmt*);
-int	_flagfmt(Fmt*);
-int	_percentfmt(Fmt*);
-int	_ifmt(Fmt*);
-int	_runefmt(Fmt*);
-int	_runesfmt(Fmt*);
-int	_strfmt(Fmt*);
-int	_badfmt(Fmt*);
-int	_fmtcpy(Fmt*, void*, int, int);
-int	_fmtrcpy(Fmt*, void*, int n);
-
-void	_fmtlock(void);
-void	_fmtunlock(void);
+/* Edit .+1,/^$/ |cfn |grep -v static | grep __ */
+double       __Inf(int sign);
+double       __NaN(void);
+int          __badfmt(Fmt *f);
+int          __charfmt(Fmt *f);
+int          __countfmt(Fmt *f);
+int          __efgfmt(Fmt *fmt);
+int          __errfmt(Fmt *f);
+int          __flagfmt(Fmt *f);
+int          __fmtFdFlush(Fmt *f);
+int          __fmtcpy(Fmt *f, const void *vm, int n, int sz);
+void*        __fmtdispatch(Fmt *f, void *fmt, int isrunes);
+void *       __fmtflush(Fmt *f, void *t, int len);
+void         __fmtlock(void);
+int          __fmtpad(Fmt *f, int n);
+double       __fmtpow10(int n);
+int          __fmtrcpy(Fmt *f, const void *vm, int n);
+void         __fmtunlock(void);
+int          __ifmt(Fmt *f);
+int          __isInf(double d, int sign);
+int          __isNaN(double d);
+int          __needsquotes(char *s, int *quotelenp);
+int          __percentfmt(Fmt *f);
+void         __quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int runesout);
+int          __quotestrfmt(int runesin, Fmt *f);
+int          __rfmtpad(Fmt *f, int n);
+int          __runefmt(Fmt *f);
+int          __runeneedsquotes(Rune *r, int *quotelenp);
+int          __runesfmt(Fmt *f);
+int          __strfmt(Fmt *f);
 
 #define FMTCHAR(f, t, s, c)\
 	do{\
 	if(t + 1 > (char*)s){\
-		t = _fmtflush(f, t, 1);\
+		t = __fmtflush(f, t, 1);\
 		if(t != nil)\
 			s = f->stop;\
 		else\
@@ -56,7 +78,7 @@ void	_fmtunlock(void);
 #define FMTRCHAR(f, t, s, c)\
 	do{\
 	if(t + 1 > (Rune*)s){\
-		t = _fmtflush(f, t, sizeof(Rune));\
+		t = __fmtflush(f, t, sizeof(Rune));\
 		if(t != nil)\
 			s = f->stop;\
 		else\
@@ -70,7 +92,7 @@ void	_fmtunlock(void);
 	Rune _rune;\
 	int _runelen;\
 	if(t + UTFmax > (char*)s && t + (_runelen = runelen(r)) > (char*)s){\
-		t = _fmtflush(f, t, _runelen);\
+		t = __fmtflush(f, t, _runelen);\
 		if(t != nil)\
 			s = f->stop;\
 		else\
@@ -83,3 +105,13 @@ void	_fmtunlock(void);
 		t += runetochar(t, &_rune);\
 	}\
 	}while(0)
+
+#ifdef va_copy
+#	define VA_COPY(a,b) va_copy(a,b)
+#	define VA_END(a) va_end(a)
+#else
+#	define VA_COPY(a,b) (a) = (b)
+#	define VA_END(a)
+#endif
+
+#define PLAN9PORT

+ 17 - 3
sys/src/cmd/unix/drawterm/libc/fmtfd.c

@@ -1,3 +1,17 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+#include <inttypes.h>
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -9,7 +23,7 @@
 int
 fmtfdflush(Fmt *f)
 {
-	if(_fmtFdFlush(f) <= 0)
+	if(__fmtFdFlush(f) <= 0)
 		return -1;
 	return f->nfmt;
 }
@@ -24,8 +38,8 @@ fmtfdinit(Fmt *f, int fd, char *buf, int size)
 	f->start = buf;
 	f->to = buf;
 	f->stop = buf + size;
-	f->flush = _fmtFdFlush;
-	f->farg = (void*)fd;
+	f->flush = __fmtFdFlush;
+	f->farg = (void*)(uintptr_t)fd;
 	f->nfmt = 0;
 	return 0;
 }

+ 33 - 0
sys/src/cmd/unix/drawterm/libc/fmtfdflush.c

@@ -0,0 +1,33 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+#include <inttypes.h>
+#include <u.h>
+#include <libc.h>
+#include "fmtdef.h"
+
+/*
+ * generic routine for flushing a formatting buffer
+ * to a file descriptor
+ */
+int
+__fmtFdFlush(Fmt *f)
+{
+	int n;
+
+	n = (char*)f->to - (char*)f->start;
+	if(n && write((uintptr_t)f->farg, f->start, n) != n)
+		return 0;
+	f->to = f->start;
+	return 1;
+}

+ 2 - 2
sys/src/cmd/unix/drawterm/libc/fmtlock.c

@@ -4,13 +4,13 @@
 static Lock fmtl;
 
 void
-_fmtlock(void)
+__fmtlock(void)
 {
 	lock(&fmtl);
 }
 
 void
-_fmtunlock(void)
+__fmtunlock(void)
 {
 	unlock(&fmtl);
 }

+ 17 - 3
sys/src/cmd/unix/drawterm/libc/fmtprint.c

@@ -1,8 +1,20 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
 
-
 /*
  * format a string into the output buffer
  * designed for formats which themselves call fmt,
@@ -17,14 +29,16 @@ fmtprint(Fmt *f, char *fmt, ...)
 	f->flags = 0;
 	f->width = 0;
 	f->prec = 0;
-	va = f->args;
+	VA_COPY(va, f->args);
+	VA_END(f->args);
 	va_start(f->args, fmt);
 	n = dofmt(f, fmt);
 	va_end(f->args);
 	f->flags = 0;
 	f->width = 0;
 	f->prec = 0;
-	f->args = va;
+	VA_COPY(f->args,va);
+	VA_END(va);
 	if(n >= 0)
 		return 0;
 	return n;

+ 40 - 25
sys/src/cmd/unix/drawterm/libc/fmtquote.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -5,7 +18,7 @@
 /*
  * How many bytes of output UTF will be produced by quoting (if necessary) this string?
  * How many runes? How much of the input will be consumed?
- * The parameter q is filled in by _quotesetup.
+ * The parameter q is filled in by __quotesetup.
  * The string may be UTF or Runes (s or r).
  * Return count does not include NUL.
  * Terminate the scan at the first of:
@@ -16,7 +29,7 @@
  * nin may be <0 initially, to avoid checking input by count.
  */
 void
-_quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int runesout)
+__quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int runesout)
 {
 	int w;
 	Rune c;
@@ -33,7 +46,7 @@ _quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int ru
 		q->nbytesout = 2;
 		q->nrunesout = 2;
 	}
-	for(; nin!=0; nin-=w){
+	for(; nin!=0; nin--){
 		if(s)
 			w = chartorune(&c, s);
 		else{
@@ -51,7 +64,7 @@ _quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int ru
 				break;
 		}
 
-		if((c <= L' ') || (c == L'\'') || (doquote!=nil && doquote(c))){
+		if((c <= L' ') || (c == L'\'') || (fmtdoquote!=nil && fmtdoquote(c))){
 			if(!q->quoted){
 				if(runesout){
 					if(1+q->nrunesout+1+1 > nout)	/* no room for quotes */
@@ -108,16 +121,16 @@ qstrfmt(char *sin, Rune *rin, Quoteinfo *q, Fmt *f)
 	w = f->width;
 	fl = f->flags;
 	if(f->runes){
-		if(!(fl & FmtLeft) && _rfmtpad(f, w - q->nrunesout) < 0)
+		if(!(fl & FmtLeft) && __rfmtpad(f, w - q->nrunesout) < 0)
 			return -1;
 	}else{
-		if(!(fl & FmtLeft) && _fmtpad(f, w - q->nbytesout) < 0)
+		if(!(fl & FmtLeft) && __fmtpad(f, w - q->nbytesout) < 0)
 			return -1;
 	}
-	t = f->to;
-	s = f->stop;
-	rt = f->to;
-	rs = f->stop;
+	t = (char*)f->to;
+	s = (char*)f->stop;
+	rt = (Rune*)f->to;
+	rs = (Rune*)f->stop;
 	if(f->runes)
 		FMTRCHAR(f, rt, rs, '\'');
 	else
@@ -152,28 +165,30 @@ qstrfmt(char *sin, Rune *rin, Quoteinfo *q, Fmt *f)
 		USED(rs);
 		f->nfmt += rt - (Rune *)f->to;
 		f->to = rt;
-		if(fl & FmtLeft && _rfmtpad(f, w - q->nrunesout) < 0)
+		if(fl & FmtLeft && __rfmtpad(f, w - q->nrunesout) < 0)
 			return -1;
 	}else{
 		FMTRUNE(f, t, s, '\'');
 		USED(s);
 		f->nfmt += t - (char *)f->to;
 		f->to = t;
-		if(fl & FmtLeft && _fmtpad(f, w - q->nbytesout) < 0)
+		if(fl & FmtLeft && __fmtpad(f, w - q->nbytesout) < 0)
 			return -1;
 	}
 	return 0;
 }
 
 int
-_quotestrfmt(int runesin, Fmt *f)
+__quotestrfmt(int runesin, Fmt *f)
 {
-	int outlen;
+	int nin, outlen;
 	Rune *r;
 	char *s;
 	Quoteinfo q;
 
-	f->flags &= ~FmtPrec;	/* ignored for %q %Q, so disable for %s %S in easy case */
+	nin = -1;
+	if(f->flags&FmtPrec)
+		nin = f->prec;
 	if(runesin){
 		r = va_arg(f->args, Rune *);
 		s = nil;
@@ -182,7 +197,7 @@ _quotestrfmt(int runesin, Fmt *f)
 		r = nil;
 	}
 	if(!s && !r)
-		return _fmtcpy(f, "<nil>", 5, 5);
+		return __fmtcpy(f, (void*)"<nil>", 5, 5);
 
 	if(f->flush)
 		outlen = 0x7FFFFFFF;	/* if we can flush, no output limit */
@@ -191,30 +206,30 @@ _quotestrfmt(int runesin, Fmt *f)
 	else
 		outlen = (char*)f->stop - (char*)f->to;
 
-	_quotesetup(s, r, -1, outlen, &q, f->flags&FmtSharp, f->runes);
+	__quotesetup(s, r, nin, outlen, &q, f->flags&FmtSharp, f->runes);
 //print("bytes in %d bytes out %d runes in %d runesout %d\n", q.nbytesin, q.nbytesout, q.nrunesin, q.nrunesout);
 
 	if(runesin){
 		if(!q.quoted)
-			return _fmtrcpy(f, r, q.nrunesin);
+			return __fmtrcpy(f, r, q.nrunesin);
 		return qstrfmt(nil, r, &q, f);
 	}
 
 	if(!q.quoted)
-		return _fmtcpy(f, s, q.nrunesin, q.nbytesin);
+		return __fmtcpy(f, s, q.nrunesin, q.nbytesin);
 	return qstrfmt(s, nil, &q, f);
 }
 
 int
 quotestrfmt(Fmt *f)
 {
-	return _quotestrfmt(0, f);
+	return __quotestrfmt(0, f);
 }
 
 int
 quoterunestrfmt(Fmt *f)
 {
-	return _quotestrfmt(1, f);
+	return __quotestrfmt(1, f);
 }
 
 void
@@ -225,22 +240,22 @@ quotefmtinstall(void)
 }
 
 int
-_needsquotes(char *s, int *quotelenp)
+__needsquotes(char *s, int *quotelenp)
 {
 	Quoteinfo q;
 
-	_quotesetup(s, nil, -1, 0x7FFFFFFF, &q, 0, 0);
+	__quotesetup(s, nil, -1, 0x7FFFFFFF, &q, 0, 0);
 	*quotelenp = q.nbytesout;
 
 	return q.quoted;
 }
 
 int
-_runeneedsquotes(Rune *r, int *quotelenp)
+__runeneedsquotes(Rune *r, int *quotelenp)
 {
 	Quoteinfo q;
 
-	_quotesetup(nil, r, -1, 0x7FFFFFFF, &q, 0, 0);
+	__quotesetup(nil, r, -1, 0x7FFFFFFF, &q, 0, 0);
 	*quotelenp = q.nrunesout;
 
 	return q.quoted;

+ 15 - 2
sys/src/cmd/unix/drawterm/libc/fmtrune.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -10,12 +23,12 @@ fmtrune(Fmt *f, int r)
 	int n;
 
 	if(f->runes){
-		rt = f->to;
+		rt = (Rune*)f->to;
 		FMTRCHAR(f, rt, f->stop, r);
 		f->to = rt;
 		n = 1;
 	}else{
-		t = f->to;
+		t = (char*)f->to;
 		FMTRUNE(f, t, f->stop, r);
 		n = t - (char*)f->to;
 		f->to = t;

+ 15 - 1
sys/src/cmd/unix/drawterm/libc/fmtstr.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 char*
 fmtstrflush(Fmt *f)
@@ -7,5 +21,5 @@ fmtstrflush(Fmt *f)
 	if(f->start == nil)
 		return nil;
 	*(char*)f->to = '\0';
-	return f->start;
+	return (char*)f->start;
 }

+ 19 - 3
sys/src/cmd/unix/drawterm/libc/fmtvprint.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -17,13 +30,16 @@ fmtvprint(Fmt *f, char *fmt, va_list args)
 	f->flags = 0;
 	f->width = 0;
 	f->prec = 0;
-	va = f->args;
-	f->args = args;
+	VA_COPY(va,f->args);
+	VA_END(f->args);
+	VA_COPY(f->args,args);
 	n = dofmt(f, fmt);
 	f->flags = 0;
 	f->width = 0;
 	f->prec = 0;
-	f->args = va;
+	VA_END(f->args);
+	VA_COPY(f->args,va);
+	VA_END(va);
 	if(n >= 0)
 		return 0;
 	return n;

+ 16 - 2
sys/src/cmd/unix/drawterm/libc/fprint.c

@@ -1,5 +1,19 @@
-#include	<u.h>
-#include	<libc.h>
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+#include <u.h>
+#include <libc.h>
+#include "fmtdef.h"
 
 int
 fprint(int fd, char *fmt, ...)

+ 25 - 13
sys/src/cmd/unix/drawterm/libc/nan64.c

@@ -7,43 +7,57 @@
 
 #include <u.h>
 #include <libc.h>
-#include "nan.h"
+#include "fmtdef.h"
 
-// typedef unsigned long long uvlong;
-// typedef unsigned long ulong;
+#if defined (__APPLE__) || (__powerpc__)
+#define _NEEDLL
+#endif
 
-static uvlong uvnan    = 0x7FF0000000000001ULL;
-static uvlong uvinf    = 0x7FF0000000000000ULL;
-static uvlong uvneginf = 0xFFF0000000000000ULL;
+static uvlong uvnan    = ((uvlong)0x7FF00000<<32)|0x00000001;
+static uvlong uvinf    = ((uvlong)0x7FF00000<<32)|0x00000000;
+static uvlong uvneginf = ((uvlong)0xFFF00000<<32)|0x00000000;
 
 double
 __NaN(void)
 {
-	return *(double*)(void*)&uvnan;
+	uvlong *p;
+
+	/* gcc complains about "return *(double*)&uvnan;" */
+	p = &uvnan;
+	return *(double*)p;
 }
 
 int
 __isNaN(double d)
 {
-	uvlong x = *(uvlong*)(void*)&d;
+	uvlong x;
+	double *p;
+
+	p = &d;
+	x = *(uvlong*)p;
 	return (ulong)(x>>32)==0x7FF00000 && !__isInf(d, 0);
 }
 
 double
 __Inf(int sign)
 {
+	uvlong *p;
+
 	if(sign < 0)
-		return *(double*)(void*)&uvinf;
+		p = &uvinf;
 	else
-		return *(double*)(void*)&uvneginf;
+		p = &uvneginf;
+	return *(double*)p;
 }
 
 int
 __isInf(double d, int sign)
 {
 	uvlong x;
+	double *p;
 
-	x = *(uvlong*)(void*)&d;
+	p = &d;
+	x = *(uvlong*)p;
 	if(sign == 0)
 		return x==uvinf || x==uvneginf;
 	else if(sign > 0)
@@ -51,5 +65,3 @@ __isInf(double d, int sign)
 	else
 		return x==uvneginf;
 }
-
-

+ 29 - 23
sys/src/cmd/unix/drawterm/libc/pow10.c

@@ -1,5 +1,19 @@
-#include	<u.h>
-#include	<libc.h>
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+#include <u.h>
+#include <libc.h>
+#include "fmtdef.h"
 
 /*
  * this table might overflow 127-bit exponent representations.
@@ -9,41 +23,33 @@
  * the presumption is that C converts fp numbers better
  * than multipication of lower powers of 10.
  */
+
 static
 double	tab[] =
 {
-	1.0e0,  1.0e1,  1.0e2,  1.0e3,  1.0e4,  1.0e5,  1.0e6,  1.0e7,  1.0e8,  1.0e9, 
-	1.0e10, 1.0e11, 1.0e12, 1.0e13, 1.0e14, 1.0e15, 1.0e16, 1.0e17, 1.0e18, 1.0e19, 
-	1.0e20, 1.0e21, 1.0e22, 1.0e23, 1.0e24, 1.0e25, 1.0e26, 1.0e27, 1.0e28, 1.0e29, 
-	1.0e30, 1.0e31, 1.0e32, 1.0e33, 1.0e34, 1.0e35, 1.0e36, 1.0e37, 1.0e38, 1.0e39, 
-	1.0e40, 1.0e41, 1.0e42, 1.0e43, 1.0e44, 1.0e45, 1.0e46, 1.0e47, 1.0e48, 1.0e49, 
-	1.0e50, 1.0e51, 1.0e52, 1.0e53, 1.0e54, 1.0e55, 1.0e56, 1.0e57, 1.0e58, 1.0e59, 
-	1.0e60, 1.0e61, 1.0e62, 1.0e63, 1.0e64, 1.0e65, 1.0e66, 1.0e67, 1.0e68, 1.0e69, 
-	1.0e70, 1.0e71, 1.0e72, 1.0e73, 1.0e74, 1.0e75, 1.0e76, 1.0e77, 1.0e78, 1.0e79, 
-	1.0e80, 1.0e81, 1.0e82, 1.0e83, 1.0e84, 1.0e85, 1.0e86, 1.0e87, 1.0e88, 1.0e89, 
-	1.0e90, 1.0e91, 1.0e92, 1.0e93, 1.0e94, 1.0e95, 1.0e96, 1.0e97, 1.0e98, 1.0e99, 
-	1.0e100,1.0e101,1.0e102,1.0e103,1.0e104,1.0e105,1.0e106,1.0e107,1.0e108,1.0e109,
-	1.0e110,1.0e111,1.0e112,1.0e113,1.0e114,1.0e115,1.0e116,1.0e117,1.0e118,1.0e119,
-	1.0e120,1.0e121,1.0e122,1.0e123,1.0e124,1.0e125,1.0e126,1.0e127,1.0e128,1.0e129,
-	1.0e130,1.0e131,1.0e132,1.0e133,1.0e134,1.0e135,1.0e136,1.0e137,1.0e138,1.0e139,
-	1.0e140,1.0e141,1.0e142,1.0e143,1.0e144,1.0e145,1.0e146,1.0e147,1.0e148,1.0e149,
-	1.0e150,1.0e151,1.0e152,1.0e153,1.0e154,1.0e155,1.0e156,1.0e157,1.0e158,1.0e159,
+	1.0e0, 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e6, 1.0e7, 1.0e8, 1.0e9,
+	1.0e10,1.0e11,1.0e12,1.0e13,1.0e14,1.0e15,1.0e16,1.0e17,1.0e18,1.0e19,
+	1.0e20,1.0e21,1.0e22,1.0e23,1.0e24,1.0e25,1.0e26,1.0e27,1.0e28,1.0e29,
+	1.0e30,1.0e31,1.0e32,1.0e33,1.0e34,1.0e35,1.0e36,1.0e37,1.0e38,1.0e39,
+	1.0e40,1.0e41,1.0e42,1.0e43,1.0e44,1.0e45,1.0e46,1.0e47,1.0e48,1.0e49,
+	1.0e50,1.0e51,1.0e52,1.0e53,1.0e54,1.0e55,1.0e56,1.0e57,1.0e58,1.0e59,
+	1.0e60,1.0e61,1.0e62,1.0e63,1.0e64,1.0e65,1.0e66,1.0e67,1.0e68,1.0e69,
 };
 
 double
-pow10(int n)
+__fmtpow10(int n)
 {
 	int m;
 
 	if(n < 0) {
 		n = -n;
-		if(n < sizeof(tab)/sizeof(tab[0]))
+		if(n < (int)(sizeof(tab)/sizeof(tab[0])))
 			return 1/tab[n];
 		m = n/2;
-		return 1/(pow10(m) * pow10(n-m));
+		return __fmtpow10(-m) * __fmtpow10(m-n);
 	}
-	if(n < sizeof(tab)/sizeof(tab[0]))
+	if(n < (int)(sizeof(tab)/sizeof(tab[0])))
 		return tab[n];
 	m = n/2;
-	return pow10(m) * pow10(n-m);
+	return __fmtpow10(m) * __fmtpow10(n-m);
 }

+ 16 - 2
sys/src/cmd/unix/drawterm/libc/print.c

@@ -1,5 +1,19 @@
-#include	<u.h>
-#include	<libc.h>
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
+#include <u.h>
+#include <libc.h>
+#include "fmtdef.h"
 
 int
 print(char *fmt, ...)

+ 14 - 0
sys/src/cmd/unix/drawterm/libc/runefmtstr.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 Rune*
 runefmtstrflush(Fmt *f)

+ 14 - 0
sys/src/cmd/unix/drawterm/libc/runeseprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 Rune*
 runeseprint(Rune *buf, Rune *e, char *fmt, ...)

+ 14 - 0
sys/src/cmd/unix/drawterm/libc/runesmprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 Rune*
 runesmprint(char *fmt, ...)

+ 14 - 0
sys/src/cmd/unix/drawterm/libc/runesnprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 int
 runesnprint(Rune *buf, int len, char *fmt, ...)

+ 14 - 0
sys/src/cmd/unix/drawterm/libc/runesprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 int
 runesprint(Rune *buf, char *fmt, ...)

+ 17 - 2
sys/src/cmd/unix/drawterm/libc/runevseprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 Rune*
 runevseprint(Rune *buf, Rune *e, char *fmt, va_list args)
@@ -15,9 +29,10 @@ runevseprint(Rune *buf, Rune *e, char *fmt, va_list args)
 	f.flush = nil;
 	f.farg = nil;
 	f.nfmt = 0;
-	f.args = args;
+	VA_COPY(f.args,args);
 	dofmt(&f, fmt);
+	VA_END(f.args);
 	*(Rune*)f.to = '\0';
-	return f.to;
+	return (Rune*)f.to;
 }
 

+ 20 - 6
sys/src/cmd/unix/drawterm/libc/runevsmprint.c

@@ -1,3 +1,16 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
 #include "fmtdef.h"
@@ -10,9 +23,9 @@ runeFmtStrFlush(Fmt *f)
 
 	if(f->start == nil)
 		return 0;
-	n = (int)f->farg;
+	n = (uintptr)f->farg;
 	n *= 2;
-	s = f->start;
+	s = (Rune*)f->start;
 	f->start = realloc(s, sizeof(Rune)*n);
 	if(f->start == nil){
 		f->farg = nil;
@@ -21,7 +34,7 @@ runeFmtStrFlush(Fmt *f)
 		free(s);
 		return 0;
 	}
-	f->farg = (void*)n;
+	f->farg = (void*)(uintptr)n;
 	f->to = (Rune*)f->start + ((Rune*)f->to - s);
 	f->stop = (Rune*)f->start + n - 1;
 	return 1;
@@ -41,7 +54,7 @@ runefmtstrinit(Fmt *f)
 	f->to = f->start;
 	f->stop = (Rune*)f->start + n - 1;
 	f->flush = runeFmtStrFlush;
-	f->farg = (void*)n;
+	f->farg = (void*)(uintptr)n;
 	f->nfmt = 0;
 	return 0;
 }
@@ -57,8 +70,9 @@ runevsmprint(char *fmt, va_list args)
 
 	if(runefmtstrinit(&f) < 0)
 		return nil;
-	f.args = args;
+	VA_COPY(f.args,args);
 	n = dofmt(&f, fmt);
+	VA_END(f.args);
 	if(f.start == nil)
 		return nil;
 	if(n < 0){
@@ -66,5 +80,5 @@ runevsmprint(char *fmt, va_list args)
 		return nil;
 	}
 	*(Rune*)f.to = '\0';
-	return f.start;
+	return (Rune*)f.start;
 }

+ 16 - 1
sys/src/cmd/unix/drawterm/libc/runevsnprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
+ * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ */
 #include <u.h>
 #include <libc.h>
+#include "fmtdef.h"
 
 int
 runevsnprint(Rune *buf, int len, char *fmt, va_list args)
@@ -15,8 +29,9 @@ runevsnprint(Rune *buf, int len, char *fmt, va_list args)
 	f.flush = nil;
 	f.farg = nil;
 	f.nfmt = 0;
-	f.args = args;
+	VA_COPY(f.args,args);
 	dofmt(&f, fmt);
+	VA_END(f.args);
 	*(Rune*)f.to = '\0';
 	return (Rune*)f.to - buf;
 }

+ 14 - 0
sys/src/cmd/unix/drawterm/libc/seprint.c

@@ -1,5 +1,19 @@
+/*
+ * The authors of this software are Rob Pike and Ken Thompson.
+ *              Copyright (c) 2002 by Lucent Technologies.