Browse Source

Plan 9 from Bell Labs 2006-04-27

David du Colombier 15 years ago
parent
commit
6ca91d4505

+ 23 - 23
dist/replica/_plan9.db

@@ -1,7 +1,7 @@
 386 - 20000000775 sys sys 1010957353 0
-386/9load - 775 sys sys 1131317303 216948
+386/9load - 775 sys sys 1146095338 217880
 386/9loaddebug - 775 sys sys 1145502380 313752
-386/9loadlite - 775 sys sys 1131317306 135668
+386/9loadlite - 775 sys sys 1146095338 136160
 386/9loadlitedebug - 775 sys sys 1145502380 201058
 386/9pc - 775 sys sys 1143137104 1913157
 386/9pc.gz - 664 sys sys 1141258202 668936
@@ -530,7 +530,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 944969312 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1143777854 816376
+386/lib/ape/libap.a - 664 sys sys 1146068622 130222
 386/lib/ape/libbsd.a - 664 sys sys 1143777854 182990
 386/lib/ape/libdraw.a - 664 sys sys 1143777856 580918
 386/lib/ape/libfmt.a - 664 sys sys 1143777857 150786
@@ -5932,33 +5932,33 @@ sys/include/ape/ar.h - 664 sys sys 944948759 354
 sys/include/ape/arpa - 20000000775 sys sys 944948760 0
 sys/include/ape/arpa/inet.h - 664 sys sys 944948760 4717
 sys/include/ape/assert.h - 664 sys sys 944948760 287
-sys/include/ape/bsd.h - 664 sys sys 1071844798 1136
+sys/include/ape/bsd.h - 664 sys sys 1146061100 1119
 sys/include/ape/ctype.h - 664 sys sys 1014927763 1654
-sys/include/ape/cursor.h - 664 sys sys 1070327358 118
+sys/include/ape/cursor.h - 664 sys sys 1146097782 161
 sys/include/ape/dirent.h - 664 sys sys 1035117682 717
-sys/include/ape/draw.h - 664 sys sys 1070327359 15998
+sys/include/ape/draw.h - 664 sys sys 1146097782 16321
 sys/include/ape/errno.h - 664 sys sys 1070327359 1525
 sys/include/ape/error.h - 664 sys sys 944948759 356
-sys/include/ape/event.h - 664 sys sys 1070327358 117
+sys/include/ape/event.h - 664 sys sys 1146097783 158
 sys/include/ape/fcntl.h - 664 sys sys 969500385 1231
-sys/include/ape/fmt.h - 664 sys sys 1070377332 3277
+sys/include/ape/fmt.h - 664 sys sys 1146097783 3361
 sys/include/ape/grp.h - 664 sys sys 944948759 389
 sys/include/ape/inttypes.h - 664 sys sys 1038237535 452
-sys/include/ape/keyboard.h - 664 sys sys 1070327358 120
+sys/include/ape/keyboard.h - 664 sys sys 1146097783 115
 sys/include/ape/lib9.h - 664 sys sys 1014927764 1626
 sys/include/ape/libl.h - 664 sys sys 944948760 331
 sys/include/ape/libnet.h - 664 sys sys 944948760 487
 sys/include/ape/libv.h - 664 sys sys 944948760 716
 sys/include/ape/limits.h - 664 sys sys 1014927764 2491
 sys/include/ape/locale.h - 664 sys sys 944948759 796
-sys/include/ape/lock.h - 664 sys sys 946054014 363
-sys/include/ape/mouse.h - 664 sys sys 1070327358 117
+sys/include/ape/lock.h - 664 sys sys 1146097783 415
+sys/include/ape/mouse.h - 664 sys sys 1146097783 112
 sys/include/ape/netdb.h - 664 sys sys 1014927764 3907
 sys/include/ape/netinet - 20000000775 sys sys 944948759 0
 sys/include/ape/netinet/in.h - 664 sys sys 944948759 4717
 sys/include/ape/netinet/tcp.h - 664 sys sys 944948759 0
 sys/include/ape/pwd.h - 664 sys sys 944948759 423
-sys/include/ape/qlock.h - 664 sys sys 1070327358 474
+sys/include/ape/qlock.h - 664 sys sys 1146097782 508
 sys/include/ape/regexp.h - 664 sys sys 988225292 1559
 sys/include/ape/select.h - 664 sys sys 944948760 779
 sys/include/ape/setjmp.h - 664 sys sys 944948760 421
@@ -5966,7 +5966,7 @@ sys/include/ape/signal.h - 664 sys sys 944948760 2619
 sys/include/ape/stddef.h - 664 sys sys 1121977155 376
 sys/include/ape/stdio.h - 664 sys sys 1121977155 5006
 sys/include/ape/stdlib.h - 664 sys sys 1038237536 1680
-sys/include/ape/string.h - 664 sys sys 1137462511 1259
+sys/include/ape/string.h - 664 sys sys 1146061100 1250
 sys/include/ape/sys - 20000000775 sys sys 1014927751 0
 sys/include/ape/sys/ioctl.h - 664 sys sys 969500381 341
 sys/include/ape/sys/limits.h - 664 sys sys 944948759 494
@@ -5985,7 +5985,7 @@ sys/include/ape/sys/utsname.h - 664 sys sys 944948759 279
 sys/include/ape/sys/wait.h - 664 sys sys 1093980308 672
 sys/include/ape/termios.h - 664 sys sys 944948760 2745
 sys/include/ape/time.h - 664 sys sys 944948760 1016
-sys/include/ape/u.h - 664 sys sys 1038237538 399
+sys/include/ape/u.h - 664 sys sys 1146097783 430
 sys/include/ape/unistd.h - 664 sys sys 1121977155 3993
 sys/include/ape/utf.h - 664 sys sys 1070327359 1595
 sys/include/ape/utime.h - 664 sys sys 944948760 259
@@ -8856,7 +8856,7 @@ sys/src/ape/lib/bsd/writev.c - 664 sys sys 1014921995 908
 sys/src/ape/lib/draw - 20000000775 sys sys 1070327097 0
 sys/src/ape/lib/draw/colors.c - 664 sys sys 1070327097 3607
 sys/src/ape/lib/draw/libc.h - 664 sys sys 1135547921 3530
-sys/src/ape/lib/draw/mkfile - 664 sys sys 1070327097 1176
+sys/src/ape/lib/draw/mkfile - 664 sys sys 1146097782 1157
 sys/src/ape/lib/fmt - 20000000775 sys sys 1070327381 0
 sys/src/ape/lib/fmt/charstod.c - 664 sys sys 1070327066 1995
 sys/src/ape/lib/fmt/dofmt.c - 664 sys sys 1143759350 9991
@@ -8864,7 +8864,7 @@ sys/src/ape/lib/fmt/dorfmt.c - 664 sys sys 1070327066 1576
 sys/src/ape/lib/fmt/errfmt.c - 664 sys sys 1070327066 948
 sys/src/ape/lib/fmt/fltfmt.c - 664 sys sys 1070327066 10300
 sys/src/ape/lib/fmt/fmt.c - 664 sys sys 1070327067 4131
-sys/src/ape/lib/fmt/fmtdef.h - 664 sys sys 1070327067 3100
+sys/src/ape/lib/fmt/fmtdef.h - 664 sys sys 1146097782 3103
 sys/src/ape/lib/fmt/fmtfd.c - 664 sys sys 1070327067 1302
 sys/src/ape/lib/fmt/fmtfdflush.c - 664 sys sys 1070327067 1077
 sys/src/ape/lib/fmt/fmtlock.c - 664 sys sys 1070327067 868
@@ -9268,21 +9268,21 @@ sys/src/cmd/9nfs/all.h - 664 sys sys 1017337813 322
 sys/src/cmd/9nfs/auth.c - 664 sys sys 1017337813 424
 sys/src/cmd/9nfs/authhostowner.c - 664 sys sys 1071498519 4190
 sys/src/cmd/9nfs/chat.c - 664 sys sys 1017337813 2096
-sys/src/cmd/9nfs/dat.h - 664 sys sys 1071498518 4406
-sys/src/cmd/9nfs/fns.h - 664 sys sys 1071498519 1908
+sys/src/cmd/9nfs/dat.h - 664 sys sys 1146061147 4432
+sys/src/cmd/9nfs/fns.h - 664 sys sys 1146061148 1927
 sys/src/cmd/9nfs/listalloc.c - 664 sys sys 1131657407 297
 sys/src/cmd/9nfs/mkfile - 664 sys sys 1071498518 640
 sys/src/cmd/9nfs/mport.c - 664 sys sys 1050715069 3779
 sys/src/cmd/9nfs/nametest.c - 664 sys sys 1015090372 1723
 sys/src/cmd/9nfs/nfs.c - 664 sys sys 1131293679 9526
 sys/src/cmd/9nfs/nfs.h - 664 sys sys 1015090372 642
-sys/src/cmd/9nfs/nfsmount.c - 664 sys sys 1071498520 6142
-sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1145192364 15772
-sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1017337815 3964
-sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1040952456 3179
+sys/src/cmd/9nfs/nfsmount.c - 664 sys sys 1146061149 6270
+sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1146061148 15831
+sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1146061148 4068
+sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1146061148 3273
 sys/src/cmd/9nfs/rpc.c - 664 sys sys 1017337815 5293
 sys/src/cmd/9nfs/rpc.h - 664 sys sys 1017337815 1996
-sys/src/cmd/9nfs/server.c - 664 sys sys 1083771826 10980
+sys/src/cmd/9nfs/server.c - 664 sys sys 1146061148 11275
 sys/src/cmd/9nfs/string.c - 664 sys sys 1017337815 1659
 sys/src/cmd/9nfs/strparse.c - 664 sys sys 1015090373 506
 sys/src/cmd/9nfs/system.c - 664 sys sys 1017337815 437

+ 23 - 23
dist/replica/plan9.db

@@ -1,7 +1,7 @@
 386 - 20000000775 sys sys 1010957353 0
-386/9load - 775 sys sys 1131317303 216948
+386/9load - 775 sys sys 1146095338 217880
 386/9loaddebug - 775 sys sys 1145502380 313752
-386/9loadlite - 775 sys sys 1131317306 135668
+386/9loadlite - 775 sys sys 1146095338 136160
 386/9loadlitedebug - 775 sys sys 1145502380 201058
 386/9pc - 775 sys sys 1143137104 1913157
 386/9pc.gz - 664 sys sys 1141258202 668936
@@ -530,7 +530,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 944969312 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1143777854 816376
+386/lib/ape/libap.a - 664 sys sys 1146068622 130222
 386/lib/ape/libbsd.a - 664 sys sys 1143777854 182990
 386/lib/ape/libdraw.a - 664 sys sys 1143777856 580918
 386/lib/ape/libfmt.a - 664 sys sys 1143777857 150786
@@ -5932,33 +5932,33 @@ sys/include/ape/ar.h - 664 sys sys 944948759 354
 sys/include/ape/arpa - 20000000775 sys sys 944948760 0
 sys/include/ape/arpa/inet.h - 664 sys sys 944948760 4717
 sys/include/ape/assert.h - 664 sys sys 944948760 287
-sys/include/ape/bsd.h - 664 sys sys 1071844798 1136
+sys/include/ape/bsd.h - 664 sys sys 1146061100 1119
 sys/include/ape/ctype.h - 664 sys sys 1014927763 1654
-sys/include/ape/cursor.h - 664 sys sys 1070327358 118
+sys/include/ape/cursor.h - 664 sys sys 1146097782 161
 sys/include/ape/dirent.h - 664 sys sys 1035117682 717
-sys/include/ape/draw.h - 664 sys sys 1070327359 15998
+sys/include/ape/draw.h - 664 sys sys 1146097782 16321
 sys/include/ape/errno.h - 664 sys sys 1070327359 1525
 sys/include/ape/error.h - 664 sys sys 944948759 356
-sys/include/ape/event.h - 664 sys sys 1070327358 117
+sys/include/ape/event.h - 664 sys sys 1146097783 158
 sys/include/ape/fcntl.h - 664 sys sys 969500385 1231
-sys/include/ape/fmt.h - 664 sys sys 1070377332 3277
+sys/include/ape/fmt.h - 664 sys sys 1146097783 3361
 sys/include/ape/grp.h - 664 sys sys 944948759 389
 sys/include/ape/inttypes.h - 664 sys sys 1038237535 452
-sys/include/ape/keyboard.h - 664 sys sys 1070327358 120
+sys/include/ape/keyboard.h - 664 sys sys 1146097783 115
 sys/include/ape/lib9.h - 664 sys sys 1014927764 1626
 sys/include/ape/libl.h - 664 sys sys 944948760 331
 sys/include/ape/libnet.h - 664 sys sys 944948760 487
 sys/include/ape/libv.h - 664 sys sys 944948760 716
 sys/include/ape/limits.h - 664 sys sys 1014927764 2491
 sys/include/ape/locale.h - 664 sys sys 944948759 796
-sys/include/ape/lock.h - 664 sys sys 946054014 363
-sys/include/ape/mouse.h - 664 sys sys 1070327358 117
+sys/include/ape/lock.h - 664 sys sys 1146097783 415
+sys/include/ape/mouse.h - 664 sys sys 1146097783 112
 sys/include/ape/netdb.h - 664 sys sys 1014927764 3907
 sys/include/ape/netinet - 20000000775 sys sys 944948759 0
 sys/include/ape/netinet/in.h - 664 sys sys 944948759 4717
 sys/include/ape/netinet/tcp.h - 664 sys sys 944948759 0
 sys/include/ape/pwd.h - 664 sys sys 944948759 423
-sys/include/ape/qlock.h - 664 sys sys 1070327358 474
+sys/include/ape/qlock.h - 664 sys sys 1146097782 508
 sys/include/ape/regexp.h - 664 sys sys 988225292 1559
 sys/include/ape/select.h - 664 sys sys 944948760 779
 sys/include/ape/setjmp.h - 664 sys sys 944948760 421
@@ -5966,7 +5966,7 @@ sys/include/ape/signal.h - 664 sys sys 944948760 2619
 sys/include/ape/stddef.h - 664 sys sys 1121977155 376
 sys/include/ape/stdio.h - 664 sys sys 1121977155 5006
 sys/include/ape/stdlib.h - 664 sys sys 1038237536 1680
-sys/include/ape/string.h - 664 sys sys 1137462511 1259
+sys/include/ape/string.h - 664 sys sys 1146061100 1250
 sys/include/ape/sys - 20000000775 sys sys 1014927751 0
 sys/include/ape/sys/ioctl.h - 664 sys sys 969500381 341
 sys/include/ape/sys/limits.h - 664 sys sys 944948759 494
@@ -5985,7 +5985,7 @@ sys/include/ape/sys/utsname.h - 664 sys sys 944948759 279
 sys/include/ape/sys/wait.h - 664 sys sys 1093980308 672
 sys/include/ape/termios.h - 664 sys sys 944948760 2745
 sys/include/ape/time.h - 664 sys sys 944948760 1016
-sys/include/ape/u.h - 664 sys sys 1038237538 399
+sys/include/ape/u.h - 664 sys sys 1146097783 430
 sys/include/ape/unistd.h - 664 sys sys 1121977155 3993
 sys/include/ape/utf.h - 664 sys sys 1070327359 1595
 sys/include/ape/utime.h - 664 sys sys 944948760 259
@@ -8856,7 +8856,7 @@ sys/src/ape/lib/bsd/writev.c - 664 sys sys 1014921995 908
 sys/src/ape/lib/draw - 20000000775 sys sys 1070327097 0
 sys/src/ape/lib/draw/colors.c - 664 sys sys 1070327097 3607
 sys/src/ape/lib/draw/libc.h - 664 sys sys 1135547921 3530
-sys/src/ape/lib/draw/mkfile - 664 sys sys 1070327097 1176
+sys/src/ape/lib/draw/mkfile - 664 sys sys 1146097782 1157
 sys/src/ape/lib/fmt - 20000000775 sys sys 1070327381 0
 sys/src/ape/lib/fmt/charstod.c - 664 sys sys 1070327066 1995
 sys/src/ape/lib/fmt/dofmt.c - 664 sys sys 1143759350 9991
@@ -8864,7 +8864,7 @@ sys/src/ape/lib/fmt/dorfmt.c - 664 sys sys 1070327066 1576
 sys/src/ape/lib/fmt/errfmt.c - 664 sys sys 1070327066 948
 sys/src/ape/lib/fmt/fltfmt.c - 664 sys sys 1070327066 10300
 sys/src/ape/lib/fmt/fmt.c - 664 sys sys 1070327067 4131
-sys/src/ape/lib/fmt/fmtdef.h - 664 sys sys 1070327067 3100
+sys/src/ape/lib/fmt/fmtdef.h - 664 sys sys 1146097782 3103
 sys/src/ape/lib/fmt/fmtfd.c - 664 sys sys 1070327067 1302
 sys/src/ape/lib/fmt/fmtfdflush.c - 664 sys sys 1070327067 1077
 sys/src/ape/lib/fmt/fmtlock.c - 664 sys sys 1070327067 868
@@ -9268,21 +9268,21 @@ sys/src/cmd/9nfs/all.h - 664 sys sys 1017337813 322
 sys/src/cmd/9nfs/auth.c - 664 sys sys 1017337813 424
 sys/src/cmd/9nfs/authhostowner.c - 664 sys sys 1071498519 4190
 sys/src/cmd/9nfs/chat.c - 664 sys sys 1017337813 2096
-sys/src/cmd/9nfs/dat.h - 664 sys sys 1071498518 4406
-sys/src/cmd/9nfs/fns.h - 664 sys sys 1071498519 1908
+sys/src/cmd/9nfs/dat.h - 664 sys sys 1146061147 4432
+sys/src/cmd/9nfs/fns.h - 664 sys sys 1146061148 1927
 sys/src/cmd/9nfs/listalloc.c - 664 sys sys 1131657407 297
 sys/src/cmd/9nfs/mkfile - 664 sys sys 1071498518 640
 sys/src/cmd/9nfs/mport.c - 664 sys sys 1050715069 3779
 sys/src/cmd/9nfs/nametest.c - 664 sys sys 1015090372 1723
 sys/src/cmd/9nfs/nfs.c - 664 sys sys 1131293679 9526
 sys/src/cmd/9nfs/nfs.h - 664 sys sys 1015090372 642
-sys/src/cmd/9nfs/nfsmount.c - 664 sys sys 1071498520 6142
-sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1145192364 15772
-sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1017337815 3964
-sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1040952456 3179
+sys/src/cmd/9nfs/nfsmount.c - 664 sys sys 1146061149 6270
+sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1146061148 15831
+sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1146061148 4068
+sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1146061148 3273
 sys/src/cmd/9nfs/rpc.c - 664 sys sys 1017337815 5293
 sys/src/cmd/9nfs/rpc.h - 664 sys sys 1017337815 1996
-sys/src/cmd/9nfs/server.c - 664 sys sys 1083771826 10980
+sys/src/cmd/9nfs/server.c - 664 sys sys 1146061148 11275
 sys/src/cmd/9nfs/string.c - 664 sys sys 1017337815 1659
 sys/src/cmd/9nfs/strparse.c - 664 sys sys 1015090373 506
 sys/src/cmd/9nfs/system.c - 664 sys sys 1017337815 437

+ 32 - 0
dist/replica/plan9.log

@@ -29527,3 +29527,35 @@
 1145934074 0 c 386/bin/aux/vga - 775 sys sys 1145933837 335827
 1145964683 0 c sys/src/cmd/exportfs/exportfs.c - 664 sys sys 1145964192 16377
 1145993491 0 c 386/bin/exportfs - 775 sys sys 1145992764 162645
+1146061910 0 c sys/include/ape/bsd.h - 664 sys sys 1146061100 1119
+1146061910 1 c sys/include/ape/cursor.h - 664 sys sys 1146061100 164
+1146061910 2 c sys/include/ape/draw.h - 664 sys sys 1146061100 16324
+1146061910 3 c sys/include/ape/event.h - 664 sys sys 1146061099 161
+1146061910 4 c sys/include/ape/fmt.h - 664 sys sys 1146061099 3364
+1146061910 5 c sys/include/ape/keyboard.h - 664 sys sys 1146061101 118
+1146061910 6 c sys/include/ape/lock.h - 664 sys sys 1146061099 382
+1146061910 7 c sys/include/ape/mouse.h - 664 sys sys 1146061101 115
+1146061910 8 c sys/include/ape/qlock.h - 664 sys sys 1146061099 510
+1146061910 9 c sys/include/ape/string.h - 664 sys sys 1146061100 1250
+1146061910 10 c sys/include/ape/u.h - 664 sys sys 1146061100 433
+1146061910 11 c sys/src/cmd/9nfs/dat.h - 664 sys sys 1146061147 4432
+1146061910 12 c sys/src/cmd/9nfs/fns.h - 664 sys sys 1146061148 1927
+1146061910 13 c sys/src/cmd/9nfs/nfsmount.c - 664 sys sys 1146061149 6270
+1146061910 14 c sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1146061148 15831
+1146061910 15 c sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1146061148 4068
+1146061910 16 c sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1146061148 3273
+1146061910 17 c sys/src/cmd/9nfs/server.c - 664 sys sys 1146061148 11275
+1146069113 0 c 386/lib/ape/libap.a - 664 sys sys 1146068622 130222
+1146096121 0 c 386/9load - 775 sys sys 1146095338 217880
+1146096121 1 c 386/9loadlite - 775 sys sys 1146095338 136160
+1146097921 0 c sys/include/ape/cursor.h - 664 sys sys 1146097782 161
+1146097921 1 c sys/include/ape/draw.h - 664 sys sys 1146097782 16321
+1146097921 2 c sys/include/ape/event.h - 664 sys sys 1146097783 158
+1146097921 3 c sys/include/ape/fmt.h - 664 sys sys 1146097783 3361
+1146097921 4 c sys/include/ape/keyboard.h - 664 sys sys 1146097783 115
+1146097921 5 c sys/include/ape/lock.h - 664 sys sys 1146097783 415
+1146097921 6 c sys/include/ape/mouse.h - 664 sys sys 1146097783 112
+1146097921 7 c sys/include/ape/qlock.h - 664 sys sys 1146097782 508
+1146097921 8 c sys/include/ape/u.h - 664 sys sys 1146097783 430
+1146097921 9 c sys/src/ape/lib/draw/mkfile - 664 sys sys 1146097782 1157
+1146097921 10 c sys/src/ape/lib/fmt/fmtdef.h - 664 sys sys 1146097782 3103

+ 7 - 8
sys/include/ape/bsd.h

@@ -1,11 +1,13 @@
-#ifndef __BSD_H__
-#define __BSD_H__
-
 #ifndef _BSD_EXTENSION
     This header file is an extension to ANSI/POSIX
 #endif
 
-#if defined(_INC_PREREQS) && !defined(__TYPES_H)
+#ifndef __BSD_H_
+#define __BSD_H_
+#pragma src "/sys/src/ape/lib/bsd"
+#pragma lib "/$M/lib/ape/libbsd.a"
+
+#ifndef __TYPES_H
 #include <sys/types.h>
 #endif
 
@@ -13,8 +15,6 @@
 extern "C" {
 #endif
 
-#pragma lib "/$M/lib/ape/libbsd.a"
-
 #ifndef _SIZE_T
 #define _SIZE_T
 typedef unsigned long size_t;
@@ -49,9 +49,8 @@ extern char	*mktemp(char *);
 extern char	*sys_errlist[];
 extern int		sys_nerr;
 
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* !__BSD_H__ */
+#endif

+ 6 - 2
sys/include/ape/cursor.h

@@ -1,6 +1,10 @@
-#ifndef _RESEARCH_SOURCE
-  This header file is not defined in ANSI or POSIX
+#ifndef _PLAN9_SOURCE
+  This header file is an extension to ANSI/POSIX
 #endif
 
+#ifndef	__CURSOR_H_
+#define	__CURSOR_H_
 #include "/sys/include/cursor.h"
 
+#endif
+

+ 22 - 3
sys/include/ape/draw.h

@@ -1,10 +1,16 @@
-#ifndef _RESEARCH_SOURCE
-  This header file is not defined in ANSI or POSIX
+#ifndef _PLAN9_SOURCE
+  This header file is an extension to ANSI/POSIX
 #endif
 
+#ifndef	__DRAW_H_
+#define	__DRAW_H_
 #pragma src "/sys/src/ape/lib/draw"
 #pragma lib "/$M/lib/ape/libdraw.a"
 
+#include <u.h>
+#include <fmt.h>
+#include <qlock.h>
+
 typedef struct	Cachefont Cachefont;
 typedef struct	Cacheinfo Cacheinfo;
 typedef struct	Cachesubf Cachesubf;
@@ -142,7 +148,10 @@ enum {
 	RGB24	= CHAN3(CRed, 8, CGreen, 8, CBlue, 8),
 	RGBA32	= CHAN4(CRed, 8, CGreen, 8, CBlue, 8, CAlpha, 8),
 	ARGB32	= CHAN4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8),	/* stupid VGAs */
-	XRGB32  = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8),
+	XRGB32	= CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8),
+	BGR24	= CHAN3(CBlue, 8, CGreen, 8, CRed, 8),
+	ABGR32	= CHAN4(CAlpha, 8, CBlue, 8, CGreen, 8, CRed, 8),
+	XBGR32	= CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8),
 };
 
 extern	char*	chantostr(char*, ulong);
@@ -316,6 +325,10 @@ struct Font
 #define	Dx(r)	((r).max.x-(r).min.x)
 #define	Dy(r)	((r).max.y-(r).min.y)
 
+#ifdef	__cplusplus
+extern "C" { 
+#endif
+
 /*
  * Image management
  */
@@ -519,3 +532,9 @@ extern	int	_compblocksize(Rectangle, int);
 extern	int		log2[];
 extern	ulong	drawld2chan[];
 extern	void		drawsetdebug(int);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif

+ 6 - 2
sys/include/ape/event.h

@@ -1,6 +1,10 @@
-#ifndef _RESEARCH_SOURCE
-  This header file is not defined in ANSI or POSIX
+#ifndef _PLAN9_SOURCE
+  This header file is an extension to ANSI/POSIX
 #endif
 
+#ifndef	__EVENT_H_
+#define	__EVENT_H_
 #include "/sys/include/event.h"
 
+#endif
+

+ 14 - 7
sys/include/ape/fmt.h

@@ -1,11 +1,13 @@
-#ifndef _FMT_H_
-#define _FMT_H_ 1
-#pragma lib "/$M/lib/ape/libfmt.a"
+#ifndef _PLAN9_SOURCE
+  This header file is an extension to ANSI/POSIX
+#endif
+
+#ifndef __FMT_H_
+#define __FMT_H_
 #pragma src "/sys/src/ape/lib/fmt"
+#pragma lib "/$M/lib/ape/libfmt.a"
 
-#if defined(__cplusplus)
-extern "C" { 
-#endif
+#include <u.h>
 
 /*
  * The authors of this software are Rob Pike and Ken Thompson.
@@ -59,6 +61,10 @@ enum{
 	FmtFlag		= FmtLDouble << 1
 };
 
+#ifdef	__cplusplus
+extern "C" { 
+#endif
+
 extern	int	print(char*, ...);
 extern	char*	seprint(char*, char*, char*, ...);
 extern	char*	vseprint(char*, char*, char*, va_list);
@@ -101,7 +107,8 @@ extern	double	fmtcharstod(int(*)(void*), void*);
 
 extern	void	werrstr(const char*, ...);
 
-#if defined(__cplusplus)
+#ifdef	__cplusplus
 }
 #endif
+
 #endif

+ 2 - 2
sys/include/ape/keyboard.h

@@ -1,5 +1,5 @@
-#ifndef _RESEARCH_SOURCE
-  This header file is not defined in ANSI or POSIX
+#ifndef _PLAN9_SOURCE
+  This header file is an extension to ANSI/POSIX
 #endif
 
 #include "/sys/include/keyboard.h"

+ 6 - 3
sys/include/ape/lock.h

@@ -1,10 +1,13 @@
+#if !defined(_RESEARCH_SOURCE) && !defined(_PLAN9_SOURCE)
+   This header file is an extension of ANSI/POSIX
+#endif
+
 #ifndef __LOCK_H
 #define __LOCK_H
-#ifndef _LOCK_EXTENSION
-   This header file is not defined in ANSI/POSIX
-#endif
 #pragma lib "/$M/lib/ape/libap.a"
 
+#include <u.h>
+
 typedef struct
 {
 	int	val;

+ 2 - 2
sys/include/ape/mouse.h

@@ -1,5 +1,5 @@
-#ifndef _RESEARCH_SOURCE
-  This header file is not defined in ANSI or POSIX
+#ifndef _PLAN9_SOURCE
+  This header file is an extension to ANSI/POSIX
 #endif
 
 #include "/sys/include/mouse.h"

+ 8 - 3
sys/include/ape/qlock.h

@@ -1,10 +1,14 @@
-#ifndef __QLOCK_H_
-#define __QLOCK_H
-#ifndef _QLOCK_EXTENSION
+#ifndef _PLAN9_SOURCE
   This header file is an extension to ANSI/POSIX
 #endif
+
+#ifndef __QLOCK_H_
+#define __QLOCK_H_
 #pragma lib "/$M/lib/ape/lib9.a"
 
+#include <u.h>
+#include <lock.h>
+
 typedef struct QLp QLp;
 struct QLp
 {
@@ -29,6 +33,7 @@ extern "C" {
 extern	void	qlock(QLock*);
 extern	void	qunlock(QLock*);
 extern	int	canqlock(QLock*);
+
 #ifdef __cplusplus
 }
 #endif

+ 3 - 3
sys/include/ape/string.h

@@ -1,5 +1,5 @@
-#ifndef __STRING
-#define __STRING
+#ifndef __STRING_H_
+#define __STRING_H_
 #pragma lib "/$M/lib/ape/libap.a"
 
 #include <stddef.h>
@@ -39,4 +39,4 @@ extern size_t strlen(const char *);
 }
 #endif
 
-#endif /* __STRING */
+#endif

+ 6 - 2
sys/include/ape/u.h

@@ -1,5 +1,7 @@
-#ifndef _RESEARCH_SOURCE
-   This header file is not defined in ANSI or POSIX
+#ifndef __U_H
+#define __U_H
+#ifndef _PLAN9_SOURCE
+   This header file is an extension to ANSI/POSIX
 #endif
 
 #define nil		((void*)0)
@@ -13,3 +15,5 @@ typedef	unsigned long long uvlong;
 typedef	ushort		Rune;
 typedef 	union FPdbleword FPdbleword;
 typedef	char*	p9va_list;
+
+#endif

+ 1 - 1
sys/src/ape/lib/draw/mkfile

@@ -69,7 +69,7 @@ UPDATE=\
 
 </sys/src/cmd/mksyslib
 
-CFLAGS=-c $CFLAGS -D_POSIX_SOURCE -D_PLAN9_SOURCE -D_RESEARCH_SOURCE -I.
+CFLAGS=-c $CFLAGS -D_POSIX_SOURCE -D_PLAN9_SOURCE -I.
 
 %.$O: /sys/src/libdraw/%.c
 	$CC $CFLAGS /sys/src/libdraw/$stem.c

+ 1 - 1
sys/src/ape/lib/fmt/fmtdef.h

@@ -37,7 +37,7 @@ typedef unsigned long long	uvlong;
 typedef long long		vlong;
 #endif
 
-#define nil		0	/* cannot be ((void*)0) because used for function pointers */
+/* #define nil		0	/* cannot be ((void*)0) because used for function pointers */
 
 typedef int (*Fmts)(Fmt*);
 

+ 2 - 1
sys/src/cmd/9nfs/dat.h

@@ -265,5 +265,6 @@ extern void	(*rpcalarm)(void);
 extern long	starttime;
 extern long	nfstime;
 extern char *	config;
-extern int staletime;
+extern int	staletime;
 extern int	messagesize;
+extern char *	commonopts;

+ 1 - 0
sys/src/cmd/9nfs/fns.h

@@ -1,3 +1,4 @@
+int	argopt(int c);
 int	auth2unix(Auth*, Authunix*);
 int	authhostowner(Session*);
 int	canlock(Lock*);

+ 8 - 4
sys/src/cmd/9nfs/nfsmount.c

@@ -40,7 +40,6 @@ mnttimer(long now)
 void
 mntinit(int argc, char **argv)
 {
-	char *argv0 = 0;
 	int tries;
 
 	config = "config";
@@ -69,9 +68,14 @@ mntinit(int argc, char **argv)
 	case 'T':
 		staletime = atoi(ARGF());
 		break;
+	default:
+		if(argopt(ARGC()) < 0)
+			sysfatal(
+"usage: %s %s [-ns] [-a dialstring] [-f srvfile] [-c uidmap] [-T staletime]",
+				argv0, commonopts);
+		break;
 	}ARGEND
 noauth=1;	/* ZZZ */
-	USED(argv0);
 	if(tries == 0 && head == 0)
 		srvinit(-1, 0, "il!bootes");
 	if(head == 0)
@@ -149,7 +153,7 @@ srvinit(int fd, char *file, char *addr)
 	xf = xfid("none", xp, 1);
 	xf->urfid = f;
 	clog("service=%s uid=%s fid=%ld\n",
-		s->service, xf->uid, xf->urfid-s->fids);
+		s->service, xf->uid, xf->urfid - s->fids);
 	if(tail)
 		tail->next = s;
 	else
@@ -200,7 +204,7 @@ mntmnt(int n, Rpccall *cmd, Rpccall *reply)
 	argptr += string2S(argptr, &root);
 	if(argptr != &((uchar *)cmd->args)[n])
 		return garbage(reply, "bad count");
-	clog("host=%I, port=%ld, root=\"%.*s\"...", 
+	clog("host=%I, port=%ld, root=\"%.*s\"...",
 		cmd->host, cmd->port, utfnlen(root.s, root.n), root.s);
 	if(auth2unix(&cmd->cred, &au) != 0){
 		chat("auth flavor=%ld, count=%ld\n",

+ 3 - 0
sys/src/cmd/9nfs/nfsserver.c

@@ -79,6 +79,9 @@ doalarm(void)
 void
 nfsinit(int argc, char **argv)
 {
+	/*
+	 * mntinit will have already parsed our options.
+	 */
 	USED(argc, argv);
 	clog("nfs file server init\n");
 	rpcalarm = doalarm;

+ 4 - 0
sys/src/cmd/9nfs/pcnfsd.c

@@ -48,6 +48,10 @@ pcinit(int argc, char **argv)
 	case 'c':
 		config = ARGF();
 		break;
+	default:
+		if(argopt(ARGC()) < 0)
+			sysfatal("usage: %s %s [-c config]", argv0, commonopts);
+		break;
 	}ARGEND;
 	clog("pc init\n");
 

+ 6 - 1
sys/src/cmd/9nfs/portmapper.c

@@ -54,7 +54,12 @@ static
 void
 pmapinit(int argc, char **argv)
 {
-	USED(argc, argv);
+	ARGBEGIN{
+	default:
+		if(argopt(ARGC()) < 0)
+			sysfatal("usage: %s %s", argv0, commonopts);
+		break;
+	}ARGEND;
 	clog("portmapper init\n");
 }
 

+ 48 - 31
sys/src/cmd/9nfs/server.c

@@ -26,11 +26,48 @@ uchar	buf[9000];
 uchar	rbuf[9000];
 uchar	resultbuf[9000];
 
+static int tcp;
+
+char *commonopts = "[-9CDrtv]";			/* for usage() messages */
+
+/*
+ * this recognises common, nominally rcp-related options.
+ * they may not take arguments.
+ */
+int
+argopt(int c)
+{
+	switch(c){
+	case '9':
+		++p9debug;
+		return 0;
+	case 'C':
+		++nocache;
+		return 0;
+	case 'D':
+		++rpcdebug;
+		return 0;
+	case 'r':
+		++rejectall;
+		return 0;
+	case 't':
+		tcp = 1;
+		return 0;
+	case 'v':
+		++chatty;
+		return 0;
+	default:
+		return -1;
+	}
+}
+
+/*
+ * all option parsing is now done in (*pg->init)(), which can call back
+ * here to argopt for common options.
+ */
 void
 server(int argc, char **argv, int myport, Progmap *progmap)
 {
-	int Argc=argc; char **Argv=argv;
-	int tcp = 0;
 	Progmap *pg;
 
 	fmtinstall('I', Iconv);
@@ -45,26 +82,6 @@ server(int argc, char **argv, int myport, Progmap *progmap)
 	case 0:
 		break;
 	}
-	ARGBEGIN{
-	case '9':
-		++p9debug;
-		break;
-	case 'r':
-		++rejectall;
-		break;
-	case 'v':
-		++chatty;
-		break;
-	case 'D':
-		++rpcdebug;
-		break;
-	case 'C':
-		++nocache;
-		break;
-	case 't':
-		tcp = 1;
-		break;
-	}ARGEND
 
 	switch(rfork(RFMEM|RFPROC)){
 	case 0:
@@ -77,7 +94,7 @@ server(int argc, char **argv, int myport, Progmap *progmap)
 	}
 
 	for(pg=progmap; pg->init; pg++)
-		(*pg->init)(Argc, Argv);
+		(*pg->init)(argc, argv);
 	if(tcp)
 		tcpserver(myport, progmap);
 	else
@@ -155,9 +172,9 @@ tcpserver(int myport, Progmap *progmap)
 			close(lctl);
 			if(data < 0)
 				exits(0);
-	
+
 			getendpoints((OUdphdr*)buf, ldir);
-	
+
 			for(;;){
 				if(servemsg(data, readtcp, writetcp, myport, progmap) < 0)
 					break;
@@ -314,7 +331,7 @@ getendpoint(char *dir, char *file, uchar *addr, uchar *port)
 	n = atoi(serv);
 	hnputs(port, n);
 }
-	
+
 static void
 getendpoints(OUdphdr *ep, char *dir)
 {
@@ -511,7 +528,7 @@ getdom(ulong ip, char *dom, int len)
 			break;
 		}
 	}
-	return 0;		
+	return 0;
 }
 
 #define	MAXCACHE	64
@@ -529,7 +546,7 @@ cachereply(Rpccall *rp, void *buf, int len)
 
 	if(ncache >= MAXCACHE){
 		if(rpcdebug)
-			fprint(2, "%s: drop  %I/%ld, xid %uld, len %d\n", 
+			fprint(2, "%s: drop  %I/%ld, xid %uld, len %d\n",
 				argv0, tail->host,
 				tail->port, tail->xid, tail->n);
 		tail = tail->prev;
@@ -556,7 +573,7 @@ cachereply(Rpccall *rp, void *buf, int len)
 	cp->n = len;
 	memmove(cp->data, buf, len);
 	if(rpcdebug)
-		fprint(2, "%s: cache %I/%ld, xid %uld, len %d\n", 
+		fprint(2, "%s: cache %I/%ld, xid %uld, len %d\n",
 			argv0, cp->host, cp->port, cp->xid, cp->n);
 }
 
@@ -585,7 +602,7 @@ replycache(int fd, Rpccall *rp, long (*writemsg)(int, void*, long))
 	}
 	(*writemsg)(fd, cp->data, cp->n);
 	if(rpcdebug)
-		fprint(2, "%s: reply %I/%ld, xid %uld, len %d\n", 
+		fprint(2, "%s: reply %I/%ld, xid %uld, len %d\n",
 			argv0, cp->host, cp->port, cp->xid, cp->n);
 	return 1;
 }
@@ -597,7 +614,7 @@ Iconv(Fmt *f)
 	ulong h;
 
 	h = va_arg(f->args, ulong);
-	snprint(buf, sizeof buf, "%ld.%ld.%ld.%ld", 
+	snprint(buf, sizeof buf, "%ld.%ld.%ld.%ld",
 		(h>>24)&0xff, (h>>16)&0xff,
 		(h>>8)&0xff, h&0xff);
 	return fmtstrcpy(f, buf);